0
我试了两种方式send email
与图像attachment.The附件显示在撰写时的主题,boby一切事后发送电子邮件在接收器它只显示subject & Body
只有没有attacthment用户越来越多。我不明白什么是我的代码下面是我的代码。请给我任何建议来完成这项任务。如何发送电子邮件与附件(图片)
类型1: -
Intent picMessageIntent = new Intent(Intent.ACTION_SEND);
picMessageIntent.setType("image/jpeg");
File downloadedPic = new File(Environment.getExternalStorageDirectory(), strFileName + ".jpg");// Art_Nature
picMessageIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(downloadedPic));//screenshotUri);//Uri.fromFile(new File("downloadedPic"))); //Uri.fromFile(downloadedPic)); // Uri.fromFile(new File("/path/to/downloadedPic")));
startActivity(Intent.createChooser(picMessageIntent, "Share image using"));
类型2:
ArrayList<Uri> uris = new ArrayList<Uri>();
Uri u;
Intent picMessageIntent = new Intent(Intent.ACTION_SEND);
picMessageIntent.setType("image/jpeg");
File downloadedPic = new File(Environment.getExternalStorageDirectory(), strFileName + ".jpg");// Art_Nature
if(downloadedPic.exists())
{
Uri u1 = Uri.fromFile(downloadedPic);
uris.add(u1);
picMessageIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
startActivity(picMessageIntent);
}
,什么是eraseContent()和sentmode – Aerrow 2013-04-17 10:07:27
eraseContent()是一个私有方法和sentMode是一个标志。你不需要他们发送电子邮件。上面贴出的代码来自Android项目。 – Radu 2013-04-17 10:16:32
好的谢谢你的回复 – Aerrow 2013-04-17 10:36:52