【发布时间】:2017-04-11 05:26:36
【问题描述】:
我想将一些照片文件添加到电子邮件意图中。 意图正在正常启动。
问题:附件未显示,例如在 GMail 应用程序中。我没有收到任何错误消息。 问题可能出在哪里?
我已经根据post 中的建议更改了我的代码,但我的代码似乎仍然无法正常工作。
我从照片对象收到的文件路径:file:///storage/emulated/0/Pictures/SMSCloudImages/IMG_20161127_121011.jpg
它应该是正确的路径,因为我可以在图库中显示图像。
Uri uri = Uri.parse("mailto:" + "someone@mail.com")
.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);
【问题讨论】:
标签: android file email android-intent