<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="level_2">
<item name="first">some value</item>
<item name="second">some value</item>
<item name="third">some value</item>
</array>
</resources>
-
int currentLevel = 2;
TypedArray testArray = getResources().obtainTypedArray(R.array.level_2);
int firstValue = testArray.getInt(0,0);
I'm trying to dynamically set the resource (array) to use based on some data. For example, I have arrays for each level like the one above. Instead of using the resource id R.array.level_2 in obtainTypedArray() I'd like to use the value of the int currentLevel in the example above.
So, some way of doing something like:
obtainTypedArray("R.array.level_"+level)
Any ideas? Thanks!