Android 电子邮件中的内嵌图像
任何人都可以建议如何在电子邮件正文中添加图像? 我尝试了,但没有答案。
这是我的代码:
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("image/jpeg");
sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "[email protected]" });
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Photo");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + _path));
sendIntent.setType("image/png;text/html");
String htmlecode =
"<html><b>Bold Text works perfectly</b>" +
"<img width='48' height='48' alt='' " +
"src='http://upload.wikimedia.org/wikipedia/commons/7/7a/Basketball.png' />" +
"</html>";
sendIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(htmlecode, imgGetter, null));
startActivity(Intent.createChooser(sendIntent, "Email:"));
这段代码有什么问题吗?
Any one can suggest how to add images in email body ?
I tried it, but no answer.
Here is my code:
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("image/jpeg");
sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "[email protected]" });
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Photo");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + _path));
sendIntent.setType("image/png;text/html");
String htmlecode =
"<html><b>Bold Text works perfectly</b>" +
"<img width='48' height='48' alt='' " +
"src='http://upload.wikimedia.org/wikipedia/commons/7/7a/Basketball.png' />" +
"</html>";
sendIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(htmlecode, imgGetter, null));
startActivity(Intent.createChooser(sendIntent, "Email:"));
wat's wrong in this code ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里有一个类似的帖子。他们建议使用:
There is a similar post here. They suggest using: