adroid intent使用
服务调用-显示网页
Uri uri = Uri.parse("http://google.com"); Intent it = new Intent(Intent.ACTION_VIEW, uri); startActivity(it);
服务调用-显示地图
Uri uri = Uri.parse("geo:38.899533,-77.036476"); Intent it = new Intent(Intent.ACTION_VIEW, uri); startActivity(it);
服务调用-路径规划
Uri uri = Uri.parse("http://maps.google.com/maps?f=d&saddr=startLat%20startLng&daddr=endLat%20endLng&hl=en"); Intent it = new Intent(Intent.ACTION_VIEW, uri); startActivity(it); //where startLat, startLng, endLat, endLng are a long with 6 decimals like: 50.123456
服务调用-电话
//叫出拨号程序 Uri uri = Uri.parse("tel:0800000123"); Intent it = new Intent(Intent.ACTION_DIAL, uri); startActivity(it); //直接打电话出去 Uri uri = Uri.parse("tel:0800000123"); Intent it = new Intent(Intent.ACTION_CALL, uri); startActivity(it); //用這個,要在 AndroidManifest.xml 中,加上 //<uses-permission id="android.permission.CALL_PHONE" />
服务调用-SMS/MMS
//调用短信程序 Intent it = new Intent(Intent.ACTION_VIEW, uri); it.putExtra("sms_body", "The SMS text"); it.setType("vnd.android-dir/mms-sms"); startActivity(it); //传送消息 Uri uri = Uri.parse("smsto://0800000123"); Intent it = new Intent(Intent.ACTION_SENDTO, uri); it.putExtra("sms_body", "The SMS text"); startActivity(it); //传送 MMS Uri uri = Uri.parse("content://media/external/images/media/23"); Intent it = new Intent(Intent.ACTION_SEND); it.putExtra("sms_body", "some text"); it.putExtra(Intent.EXTRA_STREAM, uri); it.setType("image/png"); startActivity(it);
服务调用-Email
Uri uri = Uri.parse("mailto:xxx@abc.com"); Intent it = new Intent(Intent.ACTION_SENDTO, uri); startActivity(it); Intent it = new Intent(Intent.ACTION_SEND); it.putExtra(Intent.EXTRA_EMAIL, "me@abc.com"); it.putExtra(Intent.EXTRA_TEXT, "The email body text"); it.setType("text/plain"); startActivity(Intent.createChooser(it, "Choose Email Client"));
Intent it = new Intent(Intent.ACTION_SEND); it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text"); it.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/mysong.mp3"); sendIntent.setType("audio/mp3"); startActivity(Intent.createChooser(it, "Choose Email Client"));
服务调用-多媒体
Uri uri = Uri.parse("file:///sdcard/song.mp3"); Intent it = new Intent(Intent.ACTION_VIEW, uri); it.setType("audio/mp3"); startActivity(it); Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1"); Intent it = new Intent(Intent.ACTION_VIEW, uri); startActivity(it);
服务调用-Market相关
//寻找某个应用 Uri uri = Uri.parse("market://search?q=pname:pkg_name"); Intent it = new Intent(Intent.ACTION_VIEW, uri); startActivity(it); //where pkg_name is the full package path for an application //显示某个应用的相关信息 Uri uri = Uri.parse("market://details?id=app_id"); Intent it = new Intent(Intent.ACTION_VIEW, uri); startActivity(it); //where app_id is the application ID, find the ID //by clicking on your application on Market home //page, and notice the ID from the address bar
服务调用-Uninstall应用
Uri uri = Uri.fromParts("package", strPackageName, null); Intent it = new Intent(Intent.ACTION_DELETE, uri); startActivity(it);
完
转载于:https://www.cnblogs.com/wangkangluo1/archive/2013/03/20/2970636.html
adroid intent使用相关推荐
- Adroid学习之 从源码角度分析-禁止使用回退按钮方案
有时候,不能让用户进行回退操作,如何处理? 查看返回键触发了哪些方法.在打开程序后把这个方法禁止了. 问题:程序在后台驻留,这样就会出现,其他时候也不能使用回退按钮.如何处理,在onpase()时方法 ...
- Android Intent setAction的使用注意
Action 的作用: 设置要执行的常规操作,一般在界面的隐式跳转(跳转到拨打电话界面等操作),服务,广播, Action用在隐式跳转使用 java 代码 Intent intent = new In ...
- Android Intent的 Component 使用
Intent 组成元素的列表说明 元素名称 设置方法 说明与用途 Component setComponent 组件,用于指定Intent的来源与目的 Action set ...
- Android intent 接受值的内容为空
今天写一个Intent传值,崩了,提示空指针,看了下提示接受值为空 接受之使用的String 然后自己就怀疑传递的值可能不是string 的值 最后自己打印下传递过来的值,发现 原来传递过的值不是st ...
- Android中Intent传值
1 使用intent.putExtra 传递int ,String 值 传值界面 Intent intent = new Intent(Morning.this, NoonActivity.class ...
- intent传递有没有大小限制,是多少?
intent 传递数据有大小限制 数据大于1兆 (2014kb) 的时候 就会报错 不同的手机内存不一样 传递的数据也各有差异(500k-1000k), 但是不会超过1024KB 就会报错.
- 显示intent的使用讲解
intent是android程序中各组件之间进行交互的一种重要方式,它不仅可以 指明当前组件想要执行的动作,还可以在不同组件之间传递数据, intent一般可悲用于启动活动,启动服务,以及发送广播等. ...
- android 之 Intent、broadcast
Intent的功能有: 在mainActivity中为按钮1添加监听事件: listener1 = new OnClickListener() { @Override public void ...
- Intent七大属性
一.Intent的作用是什么? 1.Intent 用于封装程序的"调用意图".两个Activity之间,可以把需要交换的数据封装成Bundle对象,然后使用Intent携带B ...
- java intent 传递集合对象_Intent之对象传递(Parcelable传递对象和对象集合)
接着上一篇文章,以下我们讨论一下怎样利用Parcelable实现Intent之间对象的传递 一.实现对象传递 首先创建User.java实现Parcelable接口: package org.yayu ...
最新文章
- Tianchi数据集最全更新!
- The import java.util cannot be resolved The import javax.servlet cannot be resolved
- Centos下源码安装golang
- 深度学习系统相比较传统的机器学习系统,针对常见的分类问题,精度究竟能有多大提升?...
- 挖掘PubMed数据库,获取报道的或推测新的基因调控关系
- gitlab nginx php解析,GitLab-webhook-PHP 详解 GitLab Webhooks 自动部署应用服务器
- 【区块链】以太坊truffle+web3+ganache简单实践
- python中哈希是什么意思_python 中倒是什么事可哈希的意思那?
- 被神话的Linux, 一文带你看清Linux在多核可扩展性设计上的不足
- 微信公众号开发:消息处理
- Windows7中被大家忽略的实用七大功能
- JAVASCRIPT 高级程序设计 第二版pdf
- EAX寄存器(关键跳,关键CALL)
- c语言数组的斐波那契数列
- 【单片机】温度感应报警装置的设计与制作(说明书)
- arcgis 线段合并
- Gerrit 2.11.5 发布,代码评审工具
- SqlHelper——数据库小助手
- javascript制作PPT
- Android Data Binding 详细介绍与使用