Created
November 3, 2015 14:20
-
-
Save Suaz/ff2bca7727970f7d4c51 to your computer and use it in GitHub Desktop.
AbsolutePath from Uri
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
public String getAbsolutePath(Uri uri) { | |
String[] projection = { MediaStore.MediaColumns.DATA }; | |
@SuppressWarnings("deprecation") | |
Cursor cursor = managedQuery(uri, projection, null, null, null); | |
if (cursor != null) { | |
int column_index = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA); | |
cursor.moveToFirst(); | |
return cursor.getString(column_index); | |
} else | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment