Here you can find the source of getByteArrayFromImageUri(Activity ctx, Uri uri)
public static Bitmap getByteArrayFromImageUri(Activity ctx, Uri uri)
//package com.java2s; import java.io.FileNotFoundException; import java.io.InputStream; import android.app.Activity; import android.content.ContentResolver; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; public class Main { public static Bitmap getByteArrayFromImageUri(Activity ctx, Uri uri) { Bitmap data = null;//from www . jav a 2 s . c om try { ContentResolver cr = ctx.getContentResolver(); InputStream inputStream = cr.openInputStream(uri); data = BitmapFactory.decodeStream(inputStream); } catch (FileNotFoundException e) { e.printStackTrace(); } return data; } }