我有一个应用程序可以通过Android上Gmail的“预览图片”来接收图片
我有uri:
内容://gmail-ls/messages/my\u gmail\u id\u gmail.com/65/attachments/0.1/simple/false
astro图像查看器或图库可以很好地显示图像
我可以使用uri:content://media/external/images/media/79
但我不知道如何使用这个uri在我的应用程序中显示图像。
请帮帮我
最佳答案
很抱歉最后的回答。我在那里有点尴尬。
但这应该是你想要的。这个确切的代码可能运行,也可能不运行,但从概念上讲,这是我发现它应该工作的方式。如果你有什么问题请告诉我。//Get your uriUri mAndroidUri = Uri.parse("content://gmail-ls/messages/my_gmail_id_@_gmail.com/65/attachments/0.1/SIMPLE/false");ImageView iv = new ImageView(context);try{ //converts android uri to java uri then from that to file //after converting to file you should be able to manipulate it in anyway you like. File mFile = new File(new URI(mAndroidUri.toString())); Bitmap bmp = BitmapFactory.decodeStream(mFile); if (null != bmp) iv.setImageBitmap(bmp); else System.out.println("The Bitmap is NULL"); }catch(Exception e){}}