davs davs - 1 year ago 191
Android Question

android get real path by Uri.getPath()

I'm trying to get image from gallery.

Intent intent = new Intent();
startActivityForResult(Intent.createChooser(intent, "Select picture"), resultCode );

After I returned from this activity I have a data, which contains Uri. It looks like:


How can I convert this path to real one (just like '
') ?


Answer Source

Is it really necessary for you to get a physical path?
For example, ImageView.setImageUri() and ContentResolver.openInputStream() allow you to access the contents of a file without knowing its real path.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download