我正在使用此代码附加文件:
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SENDTO);
String uriText;
Uri file = Uri.fromFile(new File(path));
uriText = "mailto:" +
"?subject=the subject" +
"&body=the body of the message"+
"&attachment="+file;
uriText = uriText.replace(" ", "%20");
Uri uri = Uri.parse(uriText);
emailIntent.setData(uri);
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
(请注意,path
它类似于“/sdcard/test.jpg”,我使用它ACTION_SENDTO
是因为我只想在选择器中查看电子邮件应用程序。)
该意图将提供电子邮件应用程序列表,但附件不会出现在电子邮件或 Gmail 中。如何让附件显示?