[android]代码库
android中调用系统的发送短信、发送邮件功能
2011-08-02 18:05:56| 分类: 默认分类 | 标签:android |字号 订阅
1 调用发送短信功能:
Uri smsToUri = Uri.parse("smsto:");
Intent sendIntent = new Intent(Intent.ACTION_VIEW, smsToUri);
sendIntent.putExtra("address", "123456"); //电话号码,这行去掉的话,默认就没有电话
sendIntent.putExtra("sms_body","短信内容");
sendIntent.setType("vnd.android-dir/mms-sms");
startActivity(sendIntent);
2 调用发送邮件功能:
Intent email = new Intent(android.content.Intent.ACTION_SEND);
email.setType("plain/text");
String[] emailReciver = new String[]{"xxxx@qq.com","yyy@xx.com"};
String emailSubject = "从问道分享来的文章";
String emailBody = internetpath;
//设置邮件默认地址
email.putExtra(android.content.Intent.EXTRA_EMAIL, emailReciver);
//设置邮件默认标题
email.putExtra(android.content.Intent.EXTRA_SUBJECT, emailSubject);
//设置要默认发送的内容
email.putExtra(android.content.Intent.EXTRA_TEXT, emailBody);
//调用系统的邮件系统
startActivity(Intent.createChooser(email, "请选择邮件发送软件"));
by: 发表于:2018-01-10 11:15:10 顶(0) | 踩(0) 回复
??
回复评论