Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.ContentResolver; import android.database.Cursor; import android.net.Uri; import android.provider.MediaStore.Images; public class Main { /** * Get path of image from uri * * @param contentResolver * @param contentURI * @return path of image. Null if not found. */ public static String getRealImagePathFromURI(ContentResolver contentResolver, Uri contentURI) { Cursor cursor = contentResolver.query(contentURI, null, null, null, null); if (cursor == null) return contentURI.getPath(); else { cursor.moveToFirst(); int idx = cursor.getColumnIndex(Images.ImageColumns.DATA); try { return cursor.getString(idx); } catch (Exception exception) { return null; } } } }