android-intent 使用android intent进行电子邮件共享[仅文本]
示例
这将触发本地电子邮件客户端共享文本。
参数:通过电子邮件发送至地址,主题,正文。
代码示例:
您可以在任何需要的地方调用该函数(主要在点击监听器中),如下所示
通话功能
shareEmail("sample@gmail.com", "Email sharing example", "This the sample demo to share the sample text through native email clients using Android Intent");全局功能
public void shareEmail(String to_email_id, String subject, String body) {
//此功能将打开设备中安装的电子邮件客户端,以通过意图从您自己的应用程序共享。
Intent sharingIntent = new Intent(Intent.ACTION_SEND, Uri.parse("mailto:"));
sharingIntent.setType("message/rfc822");
/* All the below fields are optional. If not given simply opens the email client */
//到电子邮件ID
sharingIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{to_email_id});
//分享时需要出现的主题
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
//邮件正文共享。
sharingIntent.putExtra(Intent.EXTRA_TEXT, body);
(mContext).startActivity(Intent.createChooser(sharingIntent, "Share content through email")
);
} //shareEmail
热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短