我试图允许用户发送带附件的电子邮件。这是我最接近的,允许选择电子邮件客户端但没有附件。我假设我的类型错了,不应该使用两个。似乎无法使用这两个附件,只有电子邮件客户端才能显示在对话框中。
Intent i = new Intent(Intent.ACTION_SEND_MULTIPLE);
i.setType("application/image");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"Jenna@JennaRocks.org"});
i.putExtra(Intent.EXTRA_SUBJECT, "SUBJECT HERE");
i.setType("message/rfc822");
// Photos
String path = prefs.getString("image_one", "");
String path2 = prefs.getString("image_two", "");
ArrayList<Uri> imageUris = new ArrayList<Uri>();
imageUris.add(Uri.parse("file://" + path)); // Add your image URIs here
imageUris.add(Uri.parse("file://" + path2)); // Add your image URIs here
i.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris);
i.putExtra(Intent.EXTRA_TEXT, "Body of text");
try {
startActivity(Intent.createChooser(i, "Send email..."));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(GrievanceFormActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}