get resource Drawable ID - Android App

Android examples for App:Resource

Description

get resource Drawable ID

Demo Code


//package com.java2s;
import android.content.Context;

public class Main {
    public static int getDrawableID(Context context, String key) {
        return context.getResources().getIdentifier(key, "drawable",
                context.getPackageName());
    }/*  ww  w . j av a 2  s.c o  m*/
}

Related Tutorials