我想添加一些照片文件到電子郵件意向。 意圖正常開始。附件未添加到電子郵件意向
問題:附件沒有顯示,例如,在GMail應用程序中。我沒有收到任何錯誤消息。 哪裏可能是問題?
我改變了我的代碼以及post中的建議,但我的代碼似乎仍然不起作用。
我從照片對象收到的文件路徑:file:///storage/emulated/0/Pictures/SMSCloudImages/IMG_20161127_121011.jpg
它應該是正確的路徑,因爲我可以在圖庫中顯示圖像。
Uri uri = Uri.parse("mailto:" + "[email protected]")
.buildUpon()
.appendQueryParameter("subject", subject)
.appendQueryParameter("body", body)
.build();
List<Photo> photoList = new ArrayList<>();
photoList.addAll(databaseHandler.getPhotos(qReport.getId()));
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, uri);
Intent intentPick = new Intent();
intentPick.setAction(Intent.ACTION_PICK_ACTIVITY);
intentPick.putExtra(Intent.EXTRA_TITLE, getResources().getString(R.string.q_report_launch_mail_text));
intentPick.putExtra(Intent.EXTRA_INTENT, emailIntent);
for (Photo photo: photoList) {
intentPick.putExtra(Intent.EXTRA_STREAM, Uri.parse(photo.getName()));
}
this.startActivityForResult(intentPick, REQUEST_CODE_MY_PICK);