I've searched for this but I'm not exactly sure what I should be searching for.
I'm trying to avoid using a SQLite DB and was wondering is it possible to call a string using the value of another string.
Eg.
If I have in a xml file this:
<string-array name="bob">
<item>1</item>
<item>4</item>
<item>7</item>
<item>11</item>
</string-array>
And in a Java file this:
String name = "bob";
can I then do something like this:
String[] holder = getResources()开发者_开发技巧.getStringArray(R.array.name);
Thanks!
If I guess correctly what you are needing is getIdentifier(). Take into account that this method is expensive and it is much more efficient to retrieve resources by identifier.
精彩评论