1.打开网页
Uri uri = Uri.parse("http://www.google.com.hk");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
2.打开地图
/* 必须使用Google APIs包 */
Uri uri = Uri.parse("geo:113.46,22.27");
Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
3.呼出电话拨号器
Uri uri = Uri.parse("tel:15013580650");
Intent intent = new Intent(Intent.ACTION_DIAL, uri);
startActivity(intent);
4.拨打电话
/* 必须加上android.permission.CALL_PHONE权限 */
Uri uri = Uri.parse("tel:15013580650");
Intent intent = new Intent(Intent.ACTION_CALL, uri);
startActivity(intent);
5.发送短信
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.putExtra("sms_body", "这里输入短信内容");
intent.setType("vnd.android-dir/mms-sms");
startActivity(intent);
6.发送短信(带号码)
Uri uri = Uri.parse("smsto:5554");
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
intent.putExtra("sms_body", "这里输入短信内容");
startActivity(intent);
7.发送彩信
// 发送彩信的图片路径
Uri uri = Uri.parse("file:///sdcard/handou.png");
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra("sms_body", "这里输入信息内容");
// 彩信附件
intent.putExtra(Intent.EXTRA_STREAM, uri);
// 文件类型
intent.setType("image/png");
startActivity(intent);
8.发送邮件
String[] tos = {"
[email protected]"};
String[] ccs = {"
[email protected]"};
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL, tos);
intent.putExtra(Intent.EXTRA_CC, ccs);
intent.putExtra(Intent.EXTRA_TEXT, "邮件正文");
intent.putExtra(Intent.EXTRA_SUBJECT, "邮件主题");
//intent.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/handou.png");
intent.setType("text/plain");
startActivity(intent);