For example if I have the following String_Array

<string-array name="recipe_ingredients">
    <item>@array/m1_ingredients</item>
    <item>@array/m2_ingredients</item>
</string-array>

How can I access @array/m1_ingredients where it is another String_Array

share|improve this question

75% accept rate
feedback

1 Answer

EDIT : No, every item of a StringArray must always be a String, of course. So it can't be another StringArray

check the Documentation on resources, scroll to StringArray

name String. A name for the array. This name will be used as the resource ID to reference the array.

here's an eg

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string-array name="planets_array">
        <item>Mercury</item>
        <item>Venus</item>
        <item>Earth</item>
        <item>Mars</item>
    </string-array>
</resources>

This application code retrieves a string array:

Resources res = getResources();
String[] planets = res.getStringArray(R.array.planets_array);
share|improve this answer
So is it possible to access Array-String from another Array-String ? – Adham Jul 14 at 7:55
sorry, i was confused – Vinay Wadhwa Jul 14 at 7:55
feedback

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.