Android examples for android.media:Media Uri
Get path For Media Uri
import android.content.ContentResolver; import android.database.Cursor; import android.net.Uri; import android.provider.BaseColumns; import android.provider.MediaStore; import android.provider.MediaStore; import java.util.ArrayList; import java.util.List; public class Main{ public static String pathForMediaUri(ContentResolver resolver, Uri uri) { final String[] columns = { android.provider.MediaStore.MediaColumns.DATA }; Cursor cursor = resolver.query(uri, columns, null, null, null); try {// w w w . j a va2 s .c om if (cursor.moveToFirst()) { return cursor.getString(0); } else { return null; } } finally { cursor.close(); } } }