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[]{"[email protected]","[email protected]"}; 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, "请选择邮件发送软件"));
Intent intent = new Intent(); intent.setAction("Android.intent.action.CALL"); intent.setData(Uri.parse("tel:"+ mobile));//mobile为你要拨打的电话号码,模拟器中为模拟器编号也可 startActivity(intent);
需要添加打电话权限:
<uses-permission android:name="android.permission.CALL_PHONE" />
4.指定android自带的浏览器访问
( “com.android.browser”:packagename ;“com.android.browser.BrowserActivity”:启动主activity)
Intent intent= new Intent(); intent.setAction("android.intent.action.VIEW"); Uri content_url = Uri.parse("http://www.cnblogs.com"); intent.setData(content_url); intent.setClassName("com.android.browser","com.android.browser.BrowserActivity"); startActivity(intent);
启动其他浏览器(当然该浏览器必须安装在机器上)
只要修改以下相应的packagename 和 主启动activity即可调用其他浏览器
intent.setClassName("com.android.browser","com.android.browser.BrowserActivity");
uc浏览器":"com.uc.browser", "com.uc.browser.ActivityUpdate“
opera :"com.opera.mini.android", "com.opera.mini.android.Browser"
qq浏览器:"com.tencent.mtt", "com.tencent.mtt.MainActivity"