Dynamic Resource Loading Android

I haven’t used it with raw files or xml layout files, but for drawables I use this:

getResources().getIdentifier("fileX", "drawable","com.yourapppackage.www");

to get the identifier (R.id) of the resource. You would need to replace drawable with something else, maybe raw or layout (untested).

Leave a Comment