Image in drawable folder
Hi Guys, At times we need to get resource id of Image in drawable folder to dynamically assign the resource Id to Imageview…
here is code snippet to get resource Id of image..
public int getImageResourceID(Context context, String imageName) {
int resId = context.getResources().getIdentifier(imageName, "drawable", "com.mypackage.namehere");
return resId;
}
hope it helps somebody