我怎么可以附加在电子邮件中的图像文件? [英] How can I attach an image file in email?

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

问题描述

我要附加图像的电子邮件,该图像存储在 /data/data/mypacke/file.png 。我怎么可以附加图像文件编程?什么样code样子?

I want to attach an image with email, that image is stored in /data/data/mypacke/file.png. How can I attach that image file programmatically? What would sample code look like?

推荐答案

使用Intent.ACTION_SEND手的形象给另一个程序。

Use Intent.ACTION_SEND to hand the image off to another program.

File F = new File("/path/to/your/file.png");
Uri U = Uri.fromFile(F);
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("image/png");
i.putExtra(Intent.EXTRA_STREAM, U);
startActivity(Intent.createChooser(i,"Email:"));

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

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