I have an image URI and I want to convert this URI to a real path. I\'ve looked at lot of of answers but none worked for me. I\'m using marshmallow 6.0.1. The image URI is
A Uri
is not a File
. A Uri
does not have to represent a file on the filesystem that you can access. The Uri
might point to content that is:
ContentProvider
needs to decrypt itContentProvider
needs to load it and serve itContentProvider
needs to download itYou can use ContentResolver
and openInputStream()
to get an InputStream
on the content represented by the Uri
. You can create a FileOutputStream
on some file that you control. And, you can use Java I/O to copy from the InputStream
to the OutputStream
, making your own copy of the content in a file that you control.