Java tutorial
//package com.java2s; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; public class Main { public static Bitmap decodeFromResource(Context context, int id) { Resources res = context.getResources(); Bitmap bitmap = BitmapFactory.decodeResource(res, id).copy(Bitmap.Config.ARGB_8888, true); return bitmap; } }