Java tutorial
//package com.java2s; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; public class Main { public static Bitmap loadBitmapRes(Context context, int res) { Bitmap bitmap = null; try { bitmap = BitmapFactory.decodeResource(context.getResources(), res); } catch (Exception e) { e.printStackTrace(); } catch (OutOfMemoryError e) { e.printStackTrace(); } return bitmap; } }