Java tutorial
//package com.java2s; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; public class Main { private static BitmapFactory.Options opt = new BitmapFactory.Options(); public static Bitmap getBitmapFromResId(Resources res, int resId) { opt.inPurgeable = true; return BitmapFactory.decodeResource(res, resId, opt); } }