Java tutorial
//package com.java2s; import android.content.Context; public class Main { /** * Get an identifier by string name * @param context The context * @param name The identifier name * @return The identifier */ public static int getDrawableIdentifier(Context context, String name) { return context.getResources().getIdentifier(name, "drawable", context.getPackageName()); } }