Android examples for Graphics:Bitmap Resource
Load a bitmap by its resource Id using the given context
//package com.java2s; import android.content.Context; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; public class Main { /** Load a bitmap by its resId using the given context */ public static Bitmap loadBitmap(Context context, int resId) { return ((BitmapDrawable) context.getResources()// .getDrawable(resId))// .getBitmap();/*from ww w.j a va 2 s . c o m*/ } }