String Intent.ACTION_VIEW = “”
用于显示用户的数据。比较通用,会根据用户的数据类型打开相应的Activity。比如 tel:13400010001打开拨号程序,则会打开浏览器等。
代码1:
Uri uri = (“”); //浏览器(网址必须带http)
//Uri uri =(“tel:1232333”); //拨号程序
//Uri uri=(“geo:39.899533,116.036476”); //打开地图定位
Intent it = new Intent(Intent.ACTION_VIEW,uri); //Intent.ACTION_VIEW不带引号
startActivity(it);
代码2:
//调用发送短信的程序
Intent it = new Intent(Intent.ACTION_VIEW);
(“sms_body”, “信息内容…”);
(“-dir/mms-sms”);
startActivity(it);
代码3:
//播放视频
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri uri = (“file:///sdcard/media.mp4”);
(uri, “video/*”);
startActivity(intent);
2 Intent.ACTION_SENDTO
String:
说明:发送短信息
//发送短信息
Uri uri = (“smsto:13200100001”);
Intent it = new Intent(Intent.ACTION_SENDTO, uri);
(“sms_body”, “信息内容…”);
startActivity(it);
//发送彩信,设备会提示选择合适的程序发送
Uri uri = (“content://media/external/images/media/23”); //设备中的资源(图像或其他资源)
Intent intent = new Intent(Intent.ACTION_SEND);
(“sms_body”, “内容”);
(Intent.EXTRA_STREAM, uri);
(“image/png”);
startActivity(it);
//Email
Intent intent=new Intent(Intent.ACTION_SEND);
String[] tos={“android1@”};
String[] ccs={“you@”};
(Intent.EXTRA_EMAIL, tos);
(Intent.EXTRA_CC, ccs);
(Intent.EXTRA_TEXT, “The email body text”);
(Intent.EXTRA_SUBJECT, “The email subject text”);
(“message/rfc822”);
startActivity((intent, “Choose Email Client”));
原文链接:Intent.ACTION_VIEW