I have one peculiar problem. I have an array inside xml file:
res/values/difficulties.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="difficulty_names">
<item> @string/easy </item>
<item> @string/medium </item>
<item> @string/hard </item>
<item> @string/insane </item>
<item> @string/preposterous </item>
<item> @string/ludicrous </item>
</string-array>
</resources>
For initialization of this array I used this method:
String[] difficultiesNamesArray = getResources().getStringArray(R.array.difficulty_names);
This worked perfectly. Until I moved this file into different folder. Since then this method stopped working. New path is:
res/arrays/difficulties.xml
I would like to know, how can I locale this file and use again getStringArray() method on this relocated xml file.
Or if it is even possible to use getResources().getStringArray(R.array.***) method. If not, how can I read an array from this different path. My guess is, that it would need to be implemented the XMLParser. But I don't know how to do it with this simple array.
At developer.android.com I found this info:
String Resources
- Define strings, string arrays, and plurals (and include string formatting and styling). Saved in res/values/ and accessed from the
R.string, R.array, and R.plurals classes.
So I think it is somehow connected with my problem that I can't use the getStringArray() method over the file located at different path then res/values/. But this is only my hunch. I don't know.
Am I right? It is possible to read an array.xml from different path? If yes How?