Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.graphics.Bitmap; import android.net.Uri; import android.provider.MediaStore; import java.io.IOException; public class Main { public static Bitmap decodeUriAsBitmap(Context context, Uri uri) { Bitmap bitmap = null; try { bitmap = MediaStore.Images.Media.getBitmap(context.getContentResolver(), uri); } catch (IOException e) { e.printStackTrace(); return null; } return bitmap; } }