Android: Getting image bitmap from third party app (e.g. WhatsApp) via content:// URI

前端 未结 1 1656
说谎
说谎 2020-12-18 05:34

I am trying to get image from third party app (e.g WhatsApp) to my app (being tested on Marshmallow). When I do \"share image\" from WhatsApp and share it with my app, I get

相关标签:
1条回答
  • 2020-12-18 06:13

    Ok. I found where was the problem. In my app's initial activity I was storing content URI (Which I got from third party app like WhatsApp or Chrome etc. for e.g. content://com.whatsapp.provider.media/item/61025) in an array and was accessing it from other activity.

    That was not correct. I got hint from this answer and I called getContentResolver().openInputStream(uri) right from the app's launcher activity immediately after I get shared contents. And it worked, didn't throw any exception.

    0 讨论(0)
提交回复
热议问题