I am new to android and I have encountered a problem. I would like to compare a String with a name of a string-array value in string.xml.
So for example my string is "img_1". Now I want to search my strings.xml for a string-array with the name "img_1". How do I compare the String with the name of a string-array value?
<string-array name="img_0">
<item>j</item>
<item>a</item>
<item>s</item>
</string-array>
<string-array name="img_1">
<item>t</item>
<item>o</item>
<item>m</item>
</string-array>
<string-array name="img_2">
<item>p</item>
<item>r</item>
<item>o</item>
</string-array>
Use Resources method getIdentifier(). Provide your string as identifier name in the parameters. The result will be the id of your string array.