在我的 android 中,如何启动带有附件的 android 撰写电子邮件 Activity ?
最佳答案
只需启动具有以下结构的 Intent :
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/html");
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"to@example.com"});
intent.putExtra(Intent.EXTRA_SUBJECT, "the subject");
intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml("the content"));
intent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/file.ext"));
startActivity(intent);
请注意,我使用的是文件的完整路径:"file:///sdcard/file.ext"
。另外,请注意您只能共享已保存到 SDCard 中的文件(否则,电子邮件客户端将忽略该文件)。
关于android - 如何在电子邮件中附加附件来启动 android 的电子邮件 Activity ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3748568/