Android examples for Graphics:Drawable Operation
Retrieves the resource ID from a string (for example, a drawable from the image name).
//package com.java2s; import android.content.Context; public class Main { /**// w ww . ja va2 s . c o m * Retrieves the resource ID from a string (for example, a drawable from the * image name). * * @param context Application or Activity context * @param type Resource type * @param resourceName Resource's name * * @return Resource ID of the named resource */ public static int resourceIdFromString(final Context context, final String type, final String resourceName) { return context.getResources().getIdentifier(resourceName, type, context.getPackageName()); } }