gpt4 book ai didi

android - 我怎样才能从 Gmail 接收图像到我在 Android 中的应用程序

转载 作者:太空狗 更新时间:2023-10-29 12:57:09 26 4
gpt4 key购买 nike

我有一个应用程序可以通过 Android 版 Gmail 中的“预览图像”接受图像

我有 Uri :

content://gmail-ls/messages/my_gmail_id_@_gmail.com/65/attachments/0.1/SIMPLE/false

Astro 图​​像查看器或图库可以很好地显示图像

我可以使用 URI:content://media/external/images/media/79

但我不知道如何使用此 Uri 在我的应用中显示图像。

请帮帮我

最佳答案

对最后一个回答感到抱歉。我在那里有点尴尬。但这应该是您正在寻找的更多内容。这个确切的代码可能会或可能不会运行,但从概念上讲,这是我发现它应该工作的方式。如果您有任何问题,请告诉我。


//Get your uri
Uri 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){}
}

关于android - 我怎样才能从 Gmail 接收图像到我在 Android 中的应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5220978/

26 4 0
文章推荐: android - 无法链接到 jni/ndk 共享库中的 libjpeg.so
文章推荐: android - 如何在已签名的 Android 应用程序上获取 map ?
文章推荐:
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com