Get filename and path from uri from mediastore

[sourcecode language=”css”]
public String getRealPathFromURI(Uri contentUri) {
String[] proj = { MediaStore.Images.Media.DATA };
Cursor cursor = managedQuery(contentUri, proj, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
}
[/sourcecode]

ref:
http://stackoverflow.com/questions/3401579/get-filename-and-path-from-uri-from-mediastore

(Visited 43 times, 1 visits today)
Spread the love