I have and image (img1.png) in my drawable-hdpi folder, but im getting NullPointerException(?) when i use the following code. Did i miss something?
int id = getResources().getIdentifier("img1", "drawable", getPackageName());
imgView.setImageResource(id);
Thanks
Try this code:
Taken from http://developer.android.com/guide/topics/resources/accessing-resources.html