Android examples for App:Resource
get Image Resource Id
//package com.java2s; import android.content.Context; public class Main { /**/* w ww. j a v a2s. c o m*/ * @param context * @param name * @return */ public static int getImageResourceId(Context context, String name) { try { return context.getResources().getIdentifier(name, "drawable", context.getPackageName()); } catch (Exception e) { e.printStackTrace(); return -1; } } }