没有合适的资源?快使用搜索试试~ 我知道了~
Android Intent的几种用法全面总结
5星 · 超过95%的资源 需积分: 7 6 下载量 127 浏览量
2013-08-07
16:00:14
上传
评论
收藏 37KB DOC 举报
温馨提示
试读
3页
Android Intent的几种用法全面总结
资源详情
资源评论
资源推荐
Intent 应该算是 Android 中特有的东西。你可以在 Intent 中指定程序要执行的动作(比
如:view,edit,dial),以及程序执行到该动作时所需要的资料。都指定好后,只要调用
startActivity(),Android 系统会自动寻找最符合你指定要求的应用程序,并执行该程序。
下面列出几种 Intent 的用法
显示网页:
1 Uri uri = Uri.parse("http://www.google.com");
2 Intent it = new Intent(Intent.ACTION_VIEW,uri);
3 startActivity(it);
复制代码
显示地图:
4 Uri uri = Uri.parse("geo:38.899533,-77.036476");
5 Intent it = new Intent(Intent.Action_VIEW,uri);
6 startActivity(it);
复制代码
路径规划:
7 Uri uri = Uri.parse("http://maps.google.com/maps?f=d&saddr=startLat
%20startLng&daddr=endLat%20endLng&hl=en");
8 Intent it = new Intent(Intent.ACTION_VIEW,URI);
9 startActivity(it);
复制代码
拨打电话:
调用拨号程序
10 Uri uri = Uri.parse("tel:xxxxxx");
11 Intent it = new Intent(Intent.ACTION_DIAL, uri);
12 startActivity(it);
复制代码
13 Uri uri = Uri.parse("tel.xxxxxx");
14 Intent it =new Intent(Intent.ACTION_CALL,uri);
15 要 使 用 这 个 必 须 在 配 置 文 件 中 加 入 <uses-permission
id="android.permission.CALL_PHONE" />
复制代码
发送 SMS/MMS
调用发送短信的程序
16 Intent it = new Intent(Intent.ACTION_VIEW);
17 it.putExtra("sms_body", "The SMS text");
Prince_fengsheng
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1