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通过<x:Array>直接为ListBox的ItemsSource赋值
<!--其中sys前缀是在xmlns中引入了System的命名空间--> <ListBox.ItemsSource> <x:Array Type="{x:Typ ...
- Flume1.6.0搭建
下载地址:http://archive.apache.org/dist/flume/ 解压完毕 切换到安装目录下/usr/local/flume/apache-flume-1.6.0-bin/conf ...
- 打乱数组——shuffle
在学习vue移动端音乐项目时,看到一个打乱数组函数,感觉很有意思就记录一下(意外发现:slice是个有趣的知识点) 原理:遍历数组,(let i = 0; i < _arr.length; i+ ...
- 如鹏网学习笔记(十)DOM
DOM笔记一.DOM简介 Document Object Model 文档对象模型 DOM的节点树模型:整个文档按照从大到小的节点划分,每一个内容都算作一个节点 DOM API 编程接口 可以用来操作 ...
- 撩课-Java每天5道面试题第12天
91.如何提升数据查询的效率? 1.首先检查表的结构是否合理, 因为采用多表查询的时候, 看主外键的引用关系是否适当. 如果不适当则重新设置表结构. 如果是应用中的系统, 则不需要更改表的字段, 只更 ...
- Spring_Spring与AOP_AspectJ基于XML的实现
一.前置通知 import org.aspectj.lang.JoinPoint; import org.aspectj.lang.ProceedingJoinPoint; import org.as ...
- C#3.0匿名类和Lanmda表达式
1.初始化器:className variableName = new className(property1=value1…); 2.var可以声明一个没有类型的变量,根据赋值的不同改变数据类型 3 ...
- hashlib 文件校验,MD5动态加盐返回加密后字符
hashlib 文件校验 # for循环校验 import hashlib def check_md5(file): ret = hashlib.md5() with open(file, mode= ...
- Mysql分布式部署高可用集群方案
HAproxy+Mycat +MySQL主从集群高可用方案 1. HAproxy高可用方案: haproxy+keepalived,利用keepalived的VIP浮动能力,(多台ha ...
- 手机浏览器的User-Agent汇总
手机浏览器的User-Agent汇总 之前介绍的 更简洁的方式修改Chrome的User Agent,轻松体验移动版网络这种简洁的方法好像只适用于Chrome, Chrome不只是浏览界面简洁,对应的 ...