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月留份纪念吧.希望对你 ...
随机推荐
- JAVA泛型——协变
在上篇<JAVA泛型——基本使用>这篇文章中遗留以下问题,即将子类型Table或者也能添加到父类型Auction的泛型中,要实现这种功能必须借助于协变. 实验准备 现在在<JAVA泛 ...
- IOS多选单选相册图片
之前做项目让实现多选相册的图片,自己写了一个demo一直保存在电脑上,今天下午发现电脑128G的容量已经快没有了,准备清理电脑,所以把之前做的一些demo放在博客上,以后方便用. 1.首先准备3个图片 ...
- 九: 操作提示(js版本)
一.toast 消息提示框 他用到了一个wx.showToast(object) 这样一个方法.作用是显示提示框. /* ---page/test/test.wxml----*/ <butt ...
- 访问Django项目出现DisallowedHost at / Invalid HTTP_HOST header问题
闲来无事,想玩玩django,源码安装碰到了一堆乱七八糟依赖性问题,耗费一下午的时间总算是在ubuntu14.04上搭建好了python3+django2开发环境, 心血来潮,创建了一个django项 ...
- Hadoop学习笔记(9) ——源码初窥
Hadoop学习笔记(9) ——源码初窥 之前我们把Hadoop算是入了门,下载的源码,写了HelloWorld,简要分析了其编程要点,然后也编了个较复杂的示例.接下来其实就有两条路可走了,一条是继续 ...
- MyBatis别名
Spring的别名管理比较规范,有严格的接口规范,SimpleAliasRegistry实现 -> AliasRegistry接口,而且是线程安全的,Map也用的是ConcurrentHashM ...
- Core.Java.Volume.I.Fundamentals.10th.Edition 14.5.8 Volatile域 中文版 章节勘误
今天重扫了corejava 14 并发的一章,在谈到volatile域代替synchronized 应用于并发更新时,看到如下内容,并发更新可用内部锁的方式但会带来阻塞问题,可用volatile域替代 ...
- win下环境变量的设置
Windows 和 linux 区别 一.查看所有环境变量的名称和值: Linux下:export Windows下:set 二.根据名称查该环境变量的值: Linux下:echo $环境变量名 比如 ...
- CodeForce 614B Gena's Code(水题)
这道题提醒我两点: 1.break时一定要检查清楚 2.字符串直接赋值一定要注意结束符,最好能用strcpy 以上是debug的惨痛教训 #include <iostream> #incl ...
- apache配置域名访问本地空间
1. 首先修改C盘WINDOWS\system32\drivers\etc目录下的 hosts 文件,用记事本打开,加入: 127.0.0.1 www.a.com hosts文件是用来解析的,你在浏览 ...