Here you can find the source of getPhotoPathByLocalUri(Context context, Intent data)
public static String getPhotoPathByLocalUri(Context context, Intent data)
//package com.java2s; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.provider.MediaStore; public class Main { public static String getPhotoPathByLocalUri(Context context, Intent data) { Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = context.getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst();/*from w w w . ja va 2s . c om*/ int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); return picturePath; } }