Created
October 26, 2015 17:15
-
-
Save r4hulp/120871b635bf8b34cac4 to your computer and use it in GitHub Desktop.
Our Implementation GetPathToImage - Part 2
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
private string GetPathToImage(Android.Net.Uri uri) | |
{ | |
ICursor cursor = this.ContentResolver.Query(uri, null, null, null, null); | |
cursor.MoveToFirst(); | |
string document_id = cursor.GetString(0); | |
if (document_id.Contains(":")) | |
document_id = document_id.Split(':')[1]; | |
cursor.Close(); | |
cursor = ContentResolver.Query( | |
Android.Provider.MediaStore.Images.Media.ExternalContentUri, | |
null, MediaStore.Images.Media.InterfaceConsts.Id + " = ? ", new String[] { document_id }, null); | |
cursor.MoveToFirst(); | |
string path = cursor.GetString(cursor.GetColumnIndex(MediaStore.Images.Media.InterfaceConsts.Data)); | |
cursor.Close(); | |
return path; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment