mike628 mike628 - 5 months ago 13
Android Question

Dynamically build a resource Identifier

I am tring to get a resource dynamically using

String[] stringarray = res.getStringArray(R.array.XXXX);


Where XXXX is a variable.
Any Suggestions?
Thanks

Answer
int resID = getResources().getIdentifier("the_variable",
    "id", "your.package.name");
String[] stringarray = res.getStringArray(resID);
Comments