Last active
April 15, 2018 09:19
-
-
Save rasheedsulayman/f213e3b5bee91966f7ce34cb26e44ffd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://stackoverflow.com/a/9989900/6484427 | |
private String getRealPathFromURI(Uri contentURI , Context context) { | |
String result; | |
Cursor cursor = context.getContentResolver().query(contentURI, null, null, null, null); | |
if (cursor == null) { // Source is Dropbox or other similar local file path | |
result = contentURI.getPath(); | |
} else { | |
cursor.moveToFirst(); | |
int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA); | |
result = cursor.getString(idx); | |
cursor.close(); | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment