编程语言
首页 > 编程语言> > 如何从Gmail接收图像到Android中的应用程序

如何从Gmail接收图像到Android中的应用程序

作者:互联网

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

我有乌里:

内容://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){}
}

标签:image,gallery,uri,android,astro
来源: https://codeday.me/bug/20191208/2093019.html