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月留份纪念吧.希望对你 ...
随机推荐
- WPF中设置Border的BorderThickness属性会让背景图片产生模糊感
<!--设置BorderThickness会让border的Background图片看起来有模糊感--> <Border x:Name="border" Bord ...
- linux 升级-杂
apt-cache search linux apt-cache search linux | grep generic apt-cache search linux | grep 4.10. apt ...
- 实例说明optimize table在优化mysql时很重要
今天在看CU的时候,发现有人问有关optimize来表优化的问题,当年因为这个问题,困扰我很长一段时间,今天有空我把这个问题,用实际数据来展示出来,让大家可以亲眼来看看,optimize table的 ...
- vlog常用参数解析
1. -f <filelist> : compile all files in filelist --------------------------------------------- ...
- 那些年,我们一起误解过的REST
欢迎大家前往腾讯云+社区,获取更多腾讯海量技术实践干货哦~ 本文由sammyshen 发表于云+社区专栏 最近几年REST API越来越流行,特别是随着微服务的概念被广泛接受和应用,很多Web Ser ...
- Oracle JDBC 连接方式
格式一: Oracle JDBC Thin using a ServiceName jdbc:oracle:thin:@//<host>:<port>/<service ...
- 你知道吗, CoreGraphics绘图系统和Bezier贝塞尔曲线坐标系的顺时针方向是相反的!
UIBezierPath是对Core Graphics框架的一种上层封装,目的是让绘图需求可以被更方便的使用. 那你有没有发现被UIBezierPath封装后与之前有什么改变? 答:有三个变化. 1. ...
- 基础爬虫,谁学谁会,用requests、正则表达式爬取豆瓣Top250电影数据!
爬取豆瓣Top250电影的评分.海报.影评等数据! 本项目是爬虫中最基础的,最简单的一例: 后面会有利用爬虫框架来完成更高级.自动化的爬虫程序. 此项目过程是运用requests请求库来获取h ...
- Oracle执行计划的查看
前言 一个系统在刚开始的时候,由于数据库中数据量不大,开发人员的主要精力都在业务与功能实现上.系统完成部署上线后随着时间的累积,每个表中的数据都在不断增长,我们往往会发现系统越来越慢,这可能是程序设计 ...
- vue+vuex+axios从后台获取数据存入vuex,组件之间共享数据
在vue项目中组件间相互传值或者后台获取的数据需要供多个组件使用的情况很多的话,有必要考虑引入vuex来管理这些凌乱的状态,今天这边博文用来记录这一整个的过程,后台api接口是使用webpack-se ...