android 唤起系统分享文件或发送邮件(附件)

耶也夜

关注

阅读 57

2022-07-30


代码如下:

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setData(Uri.parse("mailto:"));
intent.putExtra(Intent.EXTRA_EMAIL, addresses);
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
context.startActivity(Intent.createChooser(intent, "分享一下"));


兼容问题参考: https://www.jianshu.com/p/9520161ffb05


精彩评论(0)

0 0 举报