Java tutorial
//package com.java2s; //License from project: Open Source License import android.graphics.Bitmap; import android.graphics.BitmapFactory; public class Main { /** * * @param picturePath complete path name for the file to be decoded. * @return Bitmap instance */ public static Bitmap pathToBitmap(String picturePath) { BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inDither = false; //Disable Dithering mode opts.inPurgeable = true; //Tell to gc that whether it needs free memory, the Bitmap can be cleared opts.inInputShareable = true; //Which kind of reference will be used to recover the Bitmap data after being clear, when it will be used in the future opts.inTempStorage = new byte[32 * 1024]; return BitmapFactory.decodeFile(picturePath, opts); } }