- 浏览: 1536400 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (673)
- Linux (3)
- android (302)
- php (12)
- struts2 (1)
- Flex积累 (88)
- Hibernate (8)
- MyEclipse (18)
- android备忘录 (209)
- Java备忘录 (53)
- spring (0)
- Flex备忘录 (30)
- JavaScript (10)
- Tomcat (11)
- Flex FrameWork (0)
- 设计模式学习 (4)
- 休闲娱乐 (4)
- Flex skin (1)
- Flex 组件 (2)
- 持久化相关 (2)
- DotNet相关 (5)
- Flex Style (1)
- Windows (11)
- Flex AIR (9)
- MySQL (1)
- mac OSX (29)
- eclipse (26)
- database (5)
- ARM (1)
- English (1)
- WebService (8)
- javabase64 (2)
- ruby (1)
- sqlite (5)
- ios (7)
- 无线应用 (1)
- Java (3)
- goagent (1)
- oc (1)
最新评论
-
Z_ying:
谢谢分享,上次也遇到过的,解决了,过了一段时间又忘记,幸亏看到 ...
FastJson 示例 及问题 -
wto8559:
这是什么错啊,我也遇到了.问下写一个servlet能解决什么问 ...
Exception in thread "HouseKeeper" java.lang.NullPointerException -
zxjlwt:
如何用php怎么弄了。http://surenpi.com
\U672a\U77e5\U9519\U8bef 字符还原 -
windseamless:
那怎么样才能屏蔽呢
java.lang.IllegalArgumentException: Window type can not be changed after the -
macleo:
Trinea 写道还是利用Fiddler抓包更方便,(1)无需 ...
android网络抓包相关
隐式Intent理解
http://www.cnblogs.com/xirihanlin/archive/2009/07/31/1535609.html
http://blog.csdn.net/shmily_yang/article/details/5283694
http://hi.baidu.com/lfcaolibin/blog/item/87e66424c02f986b34a80f20.html
Android Intent Filter简单使用
http://bigcat.easymorse.com/?p=1454
http://blog.csdn.net/fenghome/article/details/5777855
http://blog.csdn.net/henanchina/article/details/5053691
什么是Intent
http://book.51cto.com/art/200908/142683.htm
定制android启动界面
http://blog.chinaunix.net/space.php?uid=20355083&do=blog&id=1963979
IntentFilter学习
http://www.apkbus.com/android-17556-1-1.html
http://www.cnblogs.com/Android_2011/archive/2011/06/12/2078643.html
http://www.cnblogs.com/xirihanlin/archive/2009/07/31/1535609.html
http://blog.csdn.net/shmily_yang/article/details/5283694
http://hi.baidu.com/lfcaolibin/blog/item/87e66424c02f986b34a80f20.html
Android Intent Filter简单使用
http://bigcat.easymorse.com/?p=1454
http://blog.csdn.net/fenghome/article/details/5777855
http://blog.csdn.net/henanchina/article/details/5053691
什么是Intent
http://book.51cto.com/art/200908/142683.htm
定制android启动界面
http://blog.chinaunix.net/space.php?uid=20355083&do=blog&id=1963979
IntentFilter学习
http://www.apkbus.com/android-17556-1-1.html
http://www.cnblogs.com/Android_2011/archive/2011/06/12/2078643.html
引用
IntentFilter类
IntentFilter类表示Intent过滤器, 大部分情况下, 每一个component都会定义一个或多个IntentFilter, 用于表明其可处理的Intent.
一般来说, component的IntentFilter应该在AndroidManifest.xml文件中定义.
定义的方法: 在<activity>, <receiver>, <service>元素中增加一个或多个<intent-filter>子元素. 如:
<!-- 声明作为程序入口的Activity -->
<activity android:name=".FirstActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
IntentFilter与隐式Intent
android系统处理隐式Intent时, 会比较Intent和IntentFilter的action, data, category属性, 如果以上3个属性全都相符的话, 则IntentFilter所属的component就可以作为目标组件的候选(存在多个符合条件的component时).
1. 测试action属性. intent最多只能定义1个action, 而filter可以定义1个或多个action.
通过action测试的条件为: filter定义了intent的action. 例如intent的action为"android.intent.action.MAIN", 则定义了"android.intent.action.MAIN"这个action的filter都能通过action测试(当然, filter还可以包含更多额外的action).
如果filter没有定义action, 则这个filter将阻塞所有intent. 如果intent没有定义action, 那么只要filter定义了action就可以通过action测试.
2. 测试category属性. intent可以任意多个category, filter也可以任意个category. 通过category测试的条件为: filter定义了intent的所有category. 例如intent定义了"android.intent.category.DEFAULT"和"cn.xing.intent.category.UPLOAD"这2个category, 则定义了以上2个category属性的filter才能通过测试(当然, filter还可以包含更多额外的category).
根据上面的规则, 如果一个intent没有定义category, 则所有filter都可以通过category测试. 但是有一种例外: 以startActivity(intent)方式启动一个activity时, 系统为会intent增加一个值为"android.intent.category.DEFAULT"的category, 这就意味着每一个期望通过category测试的activity, 都要在其filter中定义"android.intent.category.DEFAULT"(除了作为程序入口的activity).
3. 测试data属性. intent最多只能定义1个data, filter则可以定义多个data.
通过data测试的条件为:
a. 如果intent没有指定data和data type, 则只有没有定义data和date type的filter才能通过测试;
b. 如果intent定义了data没有定义data type, 则只有定义了相同data且没有定义date type的filter才能通过测试;
c. 如果intent没有定义data却定义了data type, 则只有未定义data且定义了相同的data type的filter才能通过测试;
d. 如果intent既定义了data也定义了data type, 则只有定义了相同的data和data type的filter才能通过测试.
data属性是一个URI, URI中包含scheme, host, post和path, 典型的URI为:
scheme://host:port/path
scheme, host, post和path都是可选的. 比较2个data时, 只比较filter中包含的部分. 比如filter的一个data只是指定了scheme部分, 则测试时只是比较data的scheme部分, 只要两者的scheme部分相同, 就视为"相同的data".
IntentFilter类表示Intent过滤器, 大部分情况下, 每一个component都会定义一个或多个IntentFilter, 用于表明其可处理的Intent.
一般来说, component的IntentFilter应该在AndroidManifest.xml文件中定义.
定义的方法: 在<activity>, <receiver>, <service>元素中增加一个或多个<intent-filter>子元素. 如:
<!-- 声明作为程序入口的Activity -->
<activity android:name=".FirstActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
IntentFilter与隐式Intent
android系统处理隐式Intent时, 会比较Intent和IntentFilter的action, data, category属性, 如果以上3个属性全都相符的话, 则IntentFilter所属的component就可以作为目标组件的候选(存在多个符合条件的component时).
1. 测试action属性. intent最多只能定义1个action, 而filter可以定义1个或多个action.
通过action测试的条件为: filter定义了intent的action. 例如intent的action为"android.intent.action.MAIN", 则定义了"android.intent.action.MAIN"这个action的filter都能通过action测试(当然, filter还可以包含更多额外的action).
如果filter没有定义action, 则这个filter将阻塞所有intent. 如果intent没有定义action, 那么只要filter定义了action就可以通过action测试.
2. 测试category属性. intent可以任意多个category, filter也可以任意个category. 通过category测试的条件为: filter定义了intent的所有category. 例如intent定义了"android.intent.category.DEFAULT"和"cn.xing.intent.category.UPLOAD"这2个category, 则定义了以上2个category属性的filter才能通过测试(当然, filter还可以包含更多额外的category).
根据上面的规则, 如果一个intent没有定义category, 则所有filter都可以通过category测试. 但是有一种例外: 以startActivity(intent)方式启动一个activity时, 系统为会intent增加一个值为"android.intent.category.DEFAULT"的category, 这就意味着每一个期望通过category测试的activity, 都要在其filter中定义"android.intent.category.DEFAULT"(除了作为程序入口的activity).
3. 测试data属性. intent最多只能定义1个data, filter则可以定义多个data.
通过data测试的条件为:
a. 如果intent没有指定data和data type, 则只有没有定义data和date type的filter才能通过测试;
b. 如果intent定义了data没有定义data type, 则只有定义了相同data且没有定义date type的filter才能通过测试;
c. 如果intent没有定义data却定义了data type, 则只有未定义data且定义了相同的data type的filter才能通过测试;
d. 如果intent既定义了data也定义了data type, 则只有定义了相同的data和data type的filter才能通过测试.
data属性是一个URI, URI中包含scheme, host, post和path, 典型的URI为:
scheme://host:port/path
scheme, host, post和path都是可选的. 比较2个data时, 只比较filter中包含的部分. 比如filter的一个data只是指定了scheme部分, 则测试时只是比较data的scheme部分, 只要两者的scheme部分相同, 就视为"相同的data".
发表评论
-
Axure 教程
2013-06-15 17:44 1154http://zhj6607.blog.163.com/blo ... -
再次android 下的Caused by: java.lang.ClassNotFoundException:
2013-06-05 11:34 2331莫名其妙发生了:Caused by: java.lang.Cl ... -
android RatingBar 收集
2013-05-29 09:50 947RatingBar例子: http://www.eoeandr ... -
java 发送邮件
2013-05-28 16:17 802http://www.blogjava.net/wangfun ... -
ExecutorService 建立多线程的步骤
2013-05-26 22:18 855http://huangxiaojian9999.blog.1 ... -
android include报错解决一例
2013-05-24 13:48 1130一个layout 嵌入另外一个layout < ... -
.net 接口报错解决一例
2013-05-24 13:44 870NullReferenceException: 未将对象引用设 ... -
Overlay移动收集
2013-05-19 17:04 8791.http://changyy.pixnet.net/blo ... -
模拟器 INSTALL_FAILED_CONTAINER_ERROR
2013-05-10 00:21 1516用模拟器跑,总是报这个错。 找了一下,发现是androidma ... -
百度地图总结
2013-05-02 11:34 10261.mMapView.regMapViewListener(a ... -
baidu 2.1.1sdk 貌似有问题
2013-05-02 11:32 9ItemOverlay 哪里去了? -
EditText SetError 4.0下 不显示文字解决
2013-04-24 16:46 2009http://www.eoeandroid.com/forum ... -
短信验证
2013-04-23 15:27 899解决方案如下: http://www.eoeandroid.c ... -
根据两个经纬度计算两地距离
2013-04-23 14:56 1632com.baidu.mapapi.utils.Distance ... -
百度地图 android 线路
2013-04-22 23:39 2449最好的资料莫过于它自己提供的了 -2.管理自己的key htt ... -
android 屏幕方向总结
2013-04-17 15:23 913http://dev.wo.com.cn/docportal/ ... -
分享总结
2013-04-15 17:28 8131。http://www.umeng.com/componen ... -
sqlitemanager
2013-03-31 23:56 1032http://blog.csdn.net/jjhua/arti ... -
android adb 无法启动
2013-03-31 23:33 1526症状: adb 有运行 但是,eclipse debug模式无 ... -
android 字体样式
2013-03-20 13:17 1079http://tank03.iteye.com/blog/13 ...
相关推荐
Android使用Intent和Intentfilter进行通信,源于《疯狂Android讲义》值得学习
Android API指南
Understanding Intent and IntentFilter–理解Intent和IntentFilterIntent(意图)在Android中是一个十分重要的组件,它是连接不同应用的桥梁和纽带,也是让组件级复用(Activity和 Service)成为可能的一个重要原因。...
要想使用隐式 Intent 成功启动 Activity, 必须保证 Intent 中 action、category、data 的设置和要启动的 Activity 的 IntentFilter 相匹配。这是一个 Intent 和 IntentFilter 匹配规则演示的小案例。 Intent 和 ...
本篇文章是对Android组件间通信Intent与IntentFilter进行了详细的分析介绍,需要的朋友参考下
主要讲解了android中Activity和intent的使用。适合初学者!
Intents and Intent Filters 三种应用程序基本组件——activity, service和broadcast receiver——是使用称为intent的消息来激活的。Intent消息传递是一种组件间运行时绑定的机制. intent是Intent对象, 它包含了...
Data、Type属性与Intent-filter配置首界面如图4所示,点击“查看图片”可以选择3个符合条件的Activity显示分别以全屏、图5和缩小三个不同的Activity显示图片。
Android_Intent和Intent_Filter详解
使用Intent filter来实现不同应用中Activity的相互跳转,点击A应用中的Activity,就跳转到B应用中的Activity,这种方式可以实现从一个应用的Activity 跳转到另一个应用的Activity,它们之间还可以传递数据。
第5章 使用Intent和IntentFilter进行通信 第6章 Android应用的资源 第7章 图形与图像处理 第8章 Android的数据存储和IO 第9章 使用ContentProvider实现数据共享 第10章 Service与Broadcast Receiver 第11章 多媒体...
第5章、使用Intent和IntentFilter进行通信 第6章、Android应用的资源 第7章、图形与图像处理 第8章、Android的数据存储和IO 第9章、使用ContentProvider实现数据共享 第10章、Service与BroadcastReceiver 第11章、...
第五章使用intent和intentFilter进行通信 第六章android应用的资源 第七章图形与图像处理 第八章android的数据存储和IO 第九章使用contentProvider实现数据共享 第十章service与broadcastReceiver 第十一章多媒体...
第五章使用intent和intentFilter进行通信 第六章android应用的资源 第七章图形与图像处理 第八章android的数据存储和IO 第九章使用contentProvider实现数据共享 第十章service与broadcastReceiver 第十一章多媒体...
第五章使用intent和intentFilter进行通信 第六章android应用的资源 第七章图形与图像处理 第八章android的数据存储和IO 第九章使用contentProvider实现数据共享 第十章service与broadcastReceiver 第十一章多媒体...
比如,有一个Activity希望打开网页浏览器查看某一网页的内容,那么这个Activity只需要发出WEB_SEARCH_ACTION给Android,Android就会根据Intent的请求内容,查询各组件注册时声明的IntentFilter,找到网页浏览器的...
Intent filter 关于Action、Category属性详解源码 对应的博客文章链接: http://blog.csdn.net/a13429921973/article/details/9271973
主要介绍了Android解析Intent Filter的方法,较为详细的分析了Intent解析的原理与相关技巧,具有一定参考借鉴价值,需要的朋友可以参考下
第5章 使用Intent和IntentFilter进行通信 第6章 Android应用的资源 第7章 图形与图像处理 第8章 Android数据存储与IO 第9章 使用ContentProvider实现数据共享 第10章 Service与BroadcastReceiver 第11章 ...
第5章 使用Intent和IntentFilter进行通信 第6章 Android应用的资源 第7章 图形与图像处理 第8章 Android数据存储与IO 第9章 使用ContentProvider实现数据共享 第10章 Service与BroadcastReceiver 第11章 ...