'How to Get Image Path in my App which is Selected from Whats app's Chat?
i have demo application with image view and in this image view i need to set image from which selected from whats app Chat, Currently i was getting Path of selected image i.e. content://com.whatsapp.provider.media/item/245429
Does any idea to resolve this ? Thank You in Advance.
Solution 1:[1]
There is no image path, as there is no requirement that this Uri
point to a file, let alone point to a file that you have direct filesystem access to.
Use an image-loading library (e.g., Glide, Picasso) and provide it the Uri
that you get from WhatsApp. Those libraries know how to use ContentResolver
and openInputStream()
to read in the bytes associated with that content, convert those bytes into a Bitmap
using BitmapFactory.decodeStream()
, and put the Bitmap
into your ImageView
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | CommonsWare |