Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String getPath(Uri uri) {
- Cursor cursor = getContentResolver().query(uri, null, null, null, null);
- cursor.moveToFirst();
- String document_id = cursor.getString(0);
- document_id = document_id.substring(document_id.lastIndexOf(":") + 1);
- cursor.close();
- cursor = getContentResolver().query(
- MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
- null, MediaStore.Images.Media._ID + " = ? ", new String[]{document_id}, null);
- cursor.moveToFirst();
- String path = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA));
- cursor.close();
- return path;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement