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