Java tutorial
//package com.java2s; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import com.google.common.io.Closeables; import java.io.FileNotFoundException; import java.io.InputStream; public class Main { public static Bitmap getBitmapFromUri(Context context, Uri uri) throws FileNotFoundException { final InputStream imageStream = context.getContentResolver().openInputStream(uri); try { return BitmapFactory.decodeStream(imageStream); } finally { Closeables.closeQuietly(imageStream); } } }