简体   繁体   English

如何从Android照片应用返回的URI中获取图像?

[英]How can I get image from URI returned from Android photos app?

I was using this question as a reference for how to get the image from a URI with an embedded URL, which was being returned from the Photos app starting a while back. 我使用此问题作为参考,以了解如何从带有嵌入式URL的URI中获取图像,该图像是从“照片”应用开始返回的。 Now, I've noticed that these URIs no longer contain this URL and rather contain some kind of key. 现在,我注意到这些URI不再包含此URL,而是包含某种密钥。 I don't know what to do to get this image now. 我不知道该怎么办才能立即获得此图像。 The URI I'm getting back looks like this: 我返回的URI如下所示:

content://com.google.android.apps.photos.contentprovider/0/1/mediaKey:/*long-key*/ACTUAL

How are we meant to use this to display a bitmap that a user selected from the Photos app? 我们如何使用它来显示用户从“照片”应用中选择的位图?

使用URI读取

getContentResolver().openInputStream(uri)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM