Get Path Name From Uri Android Lollipop
Solution 1:
Works fine
Only for the few devices that you tried, for the one file source (MediaStore) that you tried.
Is it possible get file path for choosed image from any app?
No. A Uri is not a File. There is no requirement for any Uri to be convertible into file path, as the Uri may not represent a file, let alone a file that your app has the rights to access. To you, a Uri is an opaque address to content owned by another app, much as a URL is an opaque address to content owned by a Web server. And, just as you cannot magically convert a URL into a file path that you can use, you cannot magically convert a Uri into a file path that you can use.
I need file path for ExifInterface.
In reality, you need to read, or possibly write, EXIF headers associated with a Uri that you believe points to an image that contains those headers. While ExifInterface lets you do that, it is designed for apps to work with their own images, not images from third-party apps.
Your choices are:
Use
ContentResolverandopenInputStream()on theUri, and make a local copy of the image, after which you can useExifInterfaceUse some other EXIF code that offers more flexibility. For example, the EXIF classes from the AOSP Mms app can read EXIF headers from an
InputStream
Post a Comment for "Get Path Name From Uri Android Lollipop"