Intent-filter的介绍

intent-filter主要通过三种(action  category  data)来过滤intent

1、action

一个intent 只包含一个action (可以没有),但是 一个filter可以有多个action(必须有一个,否则阻塞所有intent)并且只需要有一个action与intent中的action匹配就可以通过

2、category

一个intent 可以包含多个category(可以没有),一个filter也可以包含多个category,但是intent中的category必须是filter中的category的子集才可以通过。

3、data(scheme  path(pathPrefix  pathPattern)  host   mimeType)

一个intent可以包含一个data(可以没有),一个filter可以包含多个data并且只需要一个与intent中的data匹配就通过过滤。

scheme: 表示data 路径path的类型,比如 http、https、ftp、ed2k、file等等。

path:表示data 完全路径(不包括主机部分)

pathPrefix: 表示路径的前缀

pathPattern:用正则表达式表示路径

host:表示主机

mimeType:表示data 内容类型。

1、http://www.cnblogs.com/newcj/archive/2011/08/11/2135094.html

2、http://os.51cto.com/art/200904/118053.htm

posted @ 2013-05-02 19:47  lipeil  阅读(318)  评论(0编辑  收藏  举报