Android开发–Intent-filter属性详解
Android开发–Intent-filter属性详解
<intent-filter>元素中可以包括子元素<action>,比如:
view source print ?
- 1. < intent-filter >
- 2. < action android:name="com.example.project.SHOW_CURRENT" />
- 3. < action android:name="com.example.project.SHOW_RECENT" />
- 4. < action android:name="com.example.project.SHOW_PENDING" />
- 5. </ intent-filter >
(1) 如果<intent-filter>中没有包含任何Action类型,那么无论什么Intent请求都无法和这条<intent-filter>匹配;
(2) 反之,如果Intent请求中没有设定Action类型,那么只要<intent-filter>中包含有Action类型,这个Intent请求就将顺利地通过<intent-filter>的行为测试。
2.类别测试
<intent-filter>元素可以包含<category>子元素,比如:
view source print ?
- 1. < intent-filter . . . >
- 2. < category android:name="android.Intent.Category.DEFAULT" />
- 3. < category android:name="android.Intent.Category.BROWSABLE" />
- 4. </ intent-filter >
让该
Intent请求通过测试,IntentFilter中多余的<category>声明并不会导致匹配失败。一个没有指定任何类别测试的
IntentFilter仅仅只会匹配没有设置类别的Intent请求。
3.数据测试
数据在<intent-filter>中的描述如下:
view source print ?
- 1. < intent-filter . . . >
- 2. < data android:type="video/mpeg" android:scheme="http" . . . />
- 3. < data android:type="audio/mpeg" android:scheme="http" . . . />
- 4. </ intent-filter >
authority和path。其中,用setData()设定的Inteat请求的URI数据类型和scheme必须与IntentFilter中所指
定的一致。若IntentFilter中还指定了authority或path,它们也需要相匹配才会通过测试。
- 1. <activity android:name=".EarthquakeDamageViewer"
- 2.
- 3. android:label="View Damage">
- 4.
- 5. <intent-filter>
- 6.
- 7. <action
- 8.
- 9. android:name="com.paad.earthquake.intent.action.SHOW_DAMAGE">
- 10.
- 11. </action>
- 12.
- 13. <category android:name="android.intent.category.DEFAULT"/>
- 14.
- 15. <category
- 16.
- 17. android:name="android.intent.category.ALTERNATIVE_SELECTED"
- 18.
- 19. />
- 20.
- 21. <data android:mimeType="vnd.earthquake.cursor.item/*"/>
- 22.
- 23. </intent-filter>
- 24.
- 25. </activity>
- <activity android:name=".EarthquakeDamageViewer"
- android:label="View Damage">
- <intent-filter>
- <action
- android:name="com.paad.earthquake.intent.action.SHOW_DAMAGE">
- </action>
- <category android:name="android.intent.category.DEFAULT"/>
- <category
- android:name="android.intent.category.ALTERNATIVE_SELECTED"
- />
- <data android:mimeType="vnd.earthquake.cursor.item/*"/>
- </intent-filter>
- </activity>
Android开发–Intent-filter属性详解的更多相关文章
- Android中的windowSoftInputMode属性详解
这篇文章主要介绍了Android中的windowSoftInputMode属性详解,本文对windowSoftInputMode的9个属性做了详细总结,需要的朋友可以参考下 在前面的一篇文章中 ...
- Android TextView和EditText属性详解
TextView属性详解: autoLink设置 是否当文本为URL链接/email/电话号码/map时,文本显示为可点击的链接.可选值(none/web /email/phone/map/all) ...
- Android笔记-2-TextView的属性详解
[Android 基础]TextView的属性详解 android:autoLink :设置是否当文本为URL链接/email/电话号码/map时,文本显示为可点击的链接.可选值(none/web / ...
- Android开发之EditText属性详解
1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: 把该EditText设为:android:password="true" // 以”.”形式显示文本 ( ...
- Android开发——事件分发机制详解
0. 前言 转载请注明出处:http://blog.csdn.net/seu_calvin/article/details/52566965 深入学习事件分发机制,是为了解决在Android开发中 ...
- 【转】 Android开发之EditText属性详解
原文网址:http://blog.csdn.net/qq435757399/article/details/7947862 1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: ...
- Android开发 ExpandableListView 可折叠列表详解
前言 在需要实现一个List的item需要包含列表的时候,我们就可以选择ExpandableListView. 其实这个View的原始设计还是ListView的那套.就是增加2层的ListView而已 ...
- android中xml tools属性详解
第一部分 安卓开发中,在写布局代码的时候,ide可以看到布局的预览效果. 但是有些效果则必须在运行之后才能看见,比如这种情况:TextView在xml中没有设置任何字符,而是在activity中设置了 ...
- Android开发:程序目录结构详解
HelloWorld程序的目录结构概述 我们可以在文件夹中看到,HelloWorld程序的目录主要包括:src文件夹.gen文件夹.Android文件夹.assets.res文件夹. AndroidM ...
- android中xmlns:tools属性详解
今天读到一篇总结的非常棒的文章,写的逻辑很清晰也很实用,很少见到如此棒的文章了.就原文转发过来,我把格式给整理了一下,分享给园子里的各位朋友!好久没写博客了,就为2015年的11月留份纪念吧.希望对你 ...
随机推荐
- CSS动态控制DIV居中
1.所谓的动态:就是即使手动去拖拉浏览器,DIV还是会自动居中 2.之前一直以为这个事情是JavaScript做的, 步骤:通过先获取页面的Height和Width, 然后定义DIV的Height和W ...
- 微软URLRewriter.dll的url重写的简单使用
1.先下载MSDNURLRewriting.zip包,打开代码生成URLRewriter.dll文件: 2.将URLRewriter.dll文件引用到项目中: 3.在web.config文件中 &l ...
- SAML 2.0 Profiles--wiki
http://en.wikipedia.org/wiki/SAML_2.0#Web_Browser_SSO_Profile In SAML 2.0, as in SAML 1.1, the prima ...
- nodejs设置服务端允许跨域
//设置跨域访问 app.all('*', function(req, res, next) { res.header("Access-Control-Allow-Origin", ...
- Java基础教程(3)--回顾HelloWorld
在上一篇文章中,我们已经编写了第一个Java程序--HelloWorld,并且对它进行了编译和运行.虽然这个例子很短小,但是它具有一个完整的Java程序所应该具有的结构.在这篇文章中,我将会对这个 ...
- ROS:消息发布器和订阅器(c++)
学习资料主要源自http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29 $ roscd beginner_t ...
- 前端(十二):react-redux实现逻辑
一.context实现数据传递 在react中,props和state都可以设置数据.不同的是,props借助组件属性传递数据但不可以渲染组件,它相对来说是“静态的”:state可以监听事件来修改数据 ...
- HDU 2955(01背包)
http://acm.hdu.edu.cn/showproblem.php?pid=2955 这道题求不被抓时的最大金钱.金额是整数,概率是小数.因为数组小标不能是小数,所以我们可以以钱作为weigh ...
- csharp: using wininet.dll
/// <summary> /// Windows Embedded CE 6.0 R3 WinInet Functions /// https://technet.microsoft.c ...
- 软工读书笔记 week4 ——《黑客与画家》下
因为时间有限,只对书中后半部分几个篇章进行了阅读. 一.另一条路 作者以他自己为例,在那个没人知道什么叫“软件运行在服务器时”的时代,他和朋友选择创业时,没有选择写传统的桌面 ...