How to set the image from drawable dynamically in android?
===

I am storing my project related images in drawable folder. Also I am storing the image names in string variable and dynamically I am trying to set those images to the imageview. But the image is not displaying. Please help me in this regard. 

My Code:  

    int res = getResources().getIdentifier(imagename, "drawable", this.getPackageName());
    imageview= (ImageView)findViewById(R.id.imageView);
    imageview.setImageResource(res);

In the above code "imagename" is the sting variable which contains the image name.





Thanks in advance
