0

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.

dharam
  • 69
  • 1
  • 2
  • 5

1 Answers1

0

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.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • thanks for suggestion, i have already tried with **Picasso** , but that not and Throw Exception "File Not Found",is there any way to Get Native Image Path From Gallery ,which one file Selected in Whats App Live Chat, or Identify Selected image from Device Gallery and it's Path – dharam Sep 22 '17 at 13:30
  • @dharam: "but that not and Throw Exception "File Not Found"" -- then ask a separate Stack Overflow question with a [mcve] showing your code and the complete Java stack trace of the error. "is there any way to Get Native Image Path From Gallery" -- no. – CommonsWare Sep 22 '17 at 13:35
  • Please Check [link](https://stackoverflow.com/questions/44465601/get-path-from-another-app-whatsapp) same issue occur with me. – dharam Sep 23 '17 at 05:13
  • this was perfect work in **Gmail** , i.e. first you select an image from your chat in whats app and then share it with gmail, it can be easily show there,but same thing in my app i am geeting encoded path from whats app. – dharam Sep 23 '17 at 05:55
  • @dharam: The answer on the question that you linked to shows the same solution that I suggested: use `openInputStream()`. If you are having problems with that, as I wrote, ask a separate Stack Overflow question with a [mcve] showing your code and the complete Java stack trace of the error. – CommonsWare Sep 23 '17 at 11:25
  • @dharam Pl share ur solution here! – Shahood ul Hassan Oct 24 '19 at 13:41