附加的绘制的图像在Android的电子邮件 [英] Attaching an drawable image to email in android

查看:328
本文介绍了附加的绘制的图像在Android的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序可绘制图像的列表,并要发送的图像之一通过电子邮件。
我的code看起来像

I have a list of Drawable images in my application and want to send one of the images through mail. my code looks like

Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("image/*");
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Picture");                       
sendIntent.putExtra(Intent.EXTRA_STREAM,
                    Uri.parse(lstPhotos.get(newPosition).getPhotoURL()));
myActivity.startActivity(Intent.createChooser(sendIntent, "Email:"));

但在上述code,我有一个问题,因为我无法从可绘制的清单得到图像URI。
谁能帮我如何发送图像,因为如果我使用上述code我得到0KB SENT的空白图像。

But in the above code i have a problem since i cannot get the image URI from the list of drawables. Can anyone help me how to send the image because if i use the above code i am getting an empty image of 0kb sent.

推荐答案

您可以通过图像保存到临时位置上的内部/外部的缓存的目录为图像做出来,然后使用该图片的使用中的附件路径乌里

You can do it by saving that image to a temporary location on internal/external cache directory as an image and then use that image's path in the attachment using Uri.

这篇关于附加的绘制的图像在Android的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆