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月留份纪念吧.希望对你 ...
随机推荐
- Spring源码深度解析系列-----------org.springframework.aop-3.0.6.RELEASE
Spring源码深度解析系列-----------org.springframework.aop-3.0.6.RELEASE
- CSS选择器详解(二)通用选择器和高级选择器
目录 通用选择器 高级选择器 子选择器 相邻兄弟选择器 属性选择器 通用选择器 通用选择器可以选择页面上的所有元素,并对它们应用样式,用 * 来表示. 语法: * { property1: value ...
- 【angular5项目积累总结】优秀组件以及应用实例
1.手机端 图片预览组件 组件:sideshow 效果图:(预览图全屏 且可以左右移动) code: <div class="row ui-app-s ...
- JQuery ajax-向服务器发送请求的方法
如需将请求发送到服务器,我们使用 XMLHttpRequest 对象的 open() 和 send() 方法: xmlhttp.open("GET","ajax_info ...
- 简单的winform编辑器
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...
- fuzhou 1683 纪念SlingShot ***
Problem 1683 纪念SlingShot Accept: 361 Submit: 1287Time Limit: 1000 mSec Memory Limit : 32768 KB ...
- JavaWeb中监听器
一.事件源:三大域! ServletContext 生命周期监听:ServletContextListener,它有两个方法,一个在创建时调用,一个在销毁时调用: void contextIniti ...
- Postman如何调试
在用Postman接口测试过程当中,肯定少不了调试,下面记录一下Postman如何通过控制台输出进行调试: 一.打开控制台(View-Show Postman Console) 二.预置测试数据(测试 ...
- 浅谈 Underscore.js 中 _.throttle 和 _.debounce 的差异[转]
看的文章来自: https://blog.coding.net/blog/the-difference-between-throttle-and-debounce-in-underscorejs 使用 ...
- Evernote Markdown Sublime实现
版权声明: 欢迎转载,但请保留文章原始出处 作者:GavinCT 出处:http://www.cnblogs.com/ct2011/p/3996164.html Evernote无法实现markdow ...