安卓:如何附加资源绘制到电子邮件? [英] Android: how to attach a resource drawable to an email?
本文介绍了安卓:如何附加资源绘制到电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用下面的code发送的图像绘制作为电子邮件附件:
I'm trying to send an image drawable as an email attachment using the following code:
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, "foo@bar.com");
intent.putExtra(Intent.EXTRA_TEXT, "Lorem ipsum...");
intent.putExtra(Intent.EXTRA_STREAM, Uri.parse("android.resource://"+ getPackageName() + R.drawable.ic_launcher));
startActivity(intent);
然而,我给该文件不存在的消息。缺少什么我在这里?
However I am given a message that the file does not exist. What am I missing here?
推荐答案
您不能发送一个URI到自己的应用程序资源。该应用程序接收到该意图
不允许访问该文件。
You cannot send an URI to your own application resources. The application receiving this Intent
isn't allowed to access this file.
试着将这个文件在你的SD卡连接发送位置 Intent.EXTRA_STREAM
Try placing this file on your sdcard en send that location as Intent.EXTRA_STREAM
这篇关于安卓:如何附加资源绘制到电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文