1

I know that there is a function to get the real path from URI:

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);
}

My problem is, that managedQuery can´t be found.

I also found this solution:

ebild = Environment.getExternalStorageDirectory().getAbsolutePath() + "/DCIM/Camera/" + "filename.jpg"

but I don´t know how to get "filename.jpg". The only thing I have is the URI in the format

/external/images/media/10146

and I need it like this:

/storage/emulated/0/DCIM/Camera/1368438768752.jpg

How can I convert the URI in the right format?

user896692
  • 2,351
  • 7
  • 36
  • 57

0 Answers0