只需使用以下结构启动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);
Run Code Online (Sandbox Code Playgroud)
请注意,我正在使用文件的完整路径:"file:///sdcard/file.ext".此外,请考虑您只能将已保存的文件共享到SDCard中(否则,电子邮件客户端将忽略该文件).
| 归档时间: |
|
| 查看次数: |
3786 次 |
| 最近记录: |