Intent.ACTION_VIEW,Intent.ACTION_SENDTO
来源:互联网 发布:淘宝收信用卡1%手续费 编辑:程序博客网 时间:2024/04/30 20:58
(1)Intent.ACTION_VIEW
String android.intent.action.VIEW
用于显示用户的数据。比较通用,会根据用户的数据类型打开相应的Activity。比如 tel:13400010001打开拨号程序,http://www.g.cn则会打开浏览器等。
代码1:
Uri uri = Uri.parse("http://www.google.com"); //浏览器//Uri uri =Uri.parse("tel:1232333"); //拨号程序//Uri uri=Uri.parse("geo:39.899533,116.036476"); //打开地图定位Intent it = new Intent(Intent.ACTION_VIEW,uri); startActivity(it);
代码2:
//调用发送短信的程序Intent it = new Intent(Intent.ACTION_VIEW); it.putExtra("sms_body", "信息内容..."); it.setType("vnd.android-dir/mms-sms"); startActivity(it);
代码3:
//播放视频Intent intent = new Intent(Intent.ACTION_VIEW); Uri uri = Uri.parse("file:///sdcard/media.mp4"); intent.setDataAndType(uri, "video/*"); startActivity(intent);
(2 ) Intent.ACTION_SENDTO
String: android.intent.action.SENDTO
说明:发送短信息
//发送短信息Uri uri = Uri.parse("smsto:13200100001"); Intent it = new Intent(Intent.ACTION_SENDTO, uri); it.putExtra("sms_body", "信息内容..."); startActivity(it);
//发送彩信,设备会提示选择合适的程序发送Uri uri = Uri.parse("content://media/external/images/media/23"); //设备中的资源(图像或其他资源) Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra("sms_body", "内容"); intent.putExtra(Intent.EXTRA_STREAM, uri); intent.setType("image/png"); startActivity(it);
//EmailIntent intent=new Intent(Intent.ACTION_SEND); String[] tos={"android1@163.com"}; String[] ccs={"you@yahoo.com"}; intent.putExtra(Intent.EXTRA_EMAIL, tos); intent.putExtra(Intent.EXTRA_CC, ccs); intent.putExtra(Intent.EXTRA_TEXT, "The email body text"); intent.putExtra(Intent.EXTRA_SUBJECT, "The email subject text"); intent.setType("message/rfc822"); startActivity(Intent.createChooser(intent, "Choose Email Client"));
在Android中,调用Email有三种类型的Intent:
Intent.ACTION_SENDTO 无附件的发送
Intent.ACTION_SEND 带附件的发送
Intent.ACTION_SEND_MULTIPLE 带有多附件的发送
0 0
- Intent.ACTION_VIEW,Intent.ACTION_SENDTO
- Intent.ACTION_VIEW
- Intent.ACTION_VIEW
- Intent.ACTION_VIEW
- Intent.ACTION_VIEW
- Intent.ACTION_VIEW
- Intent.ACTION_VIEW
- Intent.ACTION_VIEW
- Intent.ACTION_VIEW
- Intent.ACTION_VIEW
- 调用Android发短信接口Intent.ACTION_SENDTO
- Intent.ACTION_VIEW无法调用短信页面
- Android VideoView通过Intent.ACTION_VIEW播放视频(4)
- Android VideoView通过Intent.ACTION_VIEW播放视频(4)
- 小错误 android下用Intent(Intent.ACTION_VIEW)打开了itms-apps:网址直接崩溃
- intent
- Intent
- Intent
- c++编程经验
- 英语听力网站,很难找的(赶紧收藏一下)
- 顺序表
- 2014-2-4TextView及其子类2
- 惠普Slate 7 Extreme平板,¥1206
- Intent.ACTION_VIEW,Intent.ACTION_SENDTO
- 凌乱的职业生涯,我将把你拿下!
- Codeforces Round #228(Div.2) A,B,C,E
- 世界这么大,我竟不知联系谁
- UML-用例图
- uva - 10905 - Children's Game(贪心,qsort排序)
- 下一个七年,我是谁?
- OpenRisc-64-添加VGA和I2C模块到ORPSoC并测试验证
- 今年应届生起薪究竟有多高?