Android examples for android.provider:MediaStore
get Local Media Path for MediaStore
//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 getLocalMediaPath(final Context context, final Intent intent) { final Uri uri = intent.getData(); final Cursor cursor = context.getContentResolver().query(uri, new String[] { MediaStore.MediaColumns.DATA }, null, null, null);/*w w w.j a va 2 s . c o m*/ if (cursor == null) { throw new RuntimeException(String.format( "Could not resolve file name for url: {0}", uri.toString())); } cursor.moveToFirst(); final String ret = cursor.getString(0); cursor.close(); return ret; } }