Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; public class Main { public static Bitmap resource2Bitmap(Context context, int picId) { Bitmap bmp = null; try { bmp = BitmapFactory.decodeResource(context.getResources(), picId); } catch (Exception e) { e.printStackTrace(); } return bmp; } }