Android examples for android.content:Context
get Resource Id
import android.content.Context; public class Main { public static int getResourceId(Context context, String variableName, String resourceName) { try {// w ww. j a v a 2 s . c o m return context.getResources().getIdentifier(variableName, resourceName, context.getPackageName()); } catch (Exception e) { e.printStackTrace(); return -1; } } }