邮件的图像附件..如何在android中? [英] image attachment to a mail.. how in android?

查看:28
本文介绍了邮件的图像附件..如何在android中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用意图选择图像及其路径.使用图像的该路径.我必须将该图像设置为邮件正文内容的附件.在安卓中怎么可能???

i can pick a image and its path using intent. with the use of that path of an image. i have to set that image as attachment of the mail's body content. how its possible in android???

推荐答案

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,getResources().getString(R.string.emlSendToFriendSubject));
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,new String[]{emailto});
emailIntent.setType("text/plain");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,getResources().getString(R.string.emlSendToFriendBody));
File file = getFileStreamPath(EMAIL_TEMP_FILE);
emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
emailIntent.setType("image/jpeg");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+file.getAbsolutePath()));
startActivityForResult(Intent.createChooser(emailIntent, getResources().getString(R.string.btnSendToFriend)),ActMain.EMAIL_DONE);

这篇关于邮件的图像附件..如何在android中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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