Skip to content

Instantly share code, notes, and snippets.

@Den-Rimus
Created May 29, 2015 09:59
Show Gist options
  • Save Den-Rimus/14085350336401d86ac3 to your computer and use it in GitHub Desktop.
Save Den-Rimus/14085350336401d86ac3 to your computer and use it in GitHub Desktop.
resolve to a path
Cursor cursor = null;
String path = null;
try {
String[] proj = { MediaStore.Images.Media.DATA };
cursor = context.getContentResolver().query(contentUri, proj, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
path = cursor.getString(column_index);
} finally {
if (cursor != null) {
cursor.close();
}
}
return path;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment