how can i get the resource id of an image if i know its name (in android)
+7
A:
With something like this:
String mDrawableName = "myappicon";
int resID = getResources().getIdentifier(mDrawableName , "drawable", getPackageName());
Francesco
2010-06-15 09:46:40
Thanks, that helped me find a solution to a simliar problem! I'll use `getResources().getIdentifier(name, "id", getPackageName());` to get the ID of an ImageButton (as you would with R.id.name).
Select0r
2010-07-26 19:19:36