Android examples for App:Resource
get Drawable Id from res
import java.lang.reflect.Field; import android.content.Context; import android.util.Log; public class Main{ public static int getDrawableId(Context ctx, String resName) { Integer id = ctx.getResources().getIdentifier(resName, "drawable", ctx.getPackageName());//from w w w . j a va 2 s .co m return id; } private static String getPackageName() { return ctx.getPackageName(); //return "com.lostad.app"; } }