IntentFilter 简述: 结构化描述 intent 匹配的信息。包含: action , categories and data(via type,scheme ,path), 还有 priority, to order multiple matching filters. IntentFilter 中如果 action 为空,则视为通配符,如果 type 为空,则 intent 必须不设 type ,否则匹配不上。 data 被分为 3 个属性: type,scheme,authority/path 任何设置的属性 intent 必须匹配上。设置了 scheme 而没设 type, 则 intent 也必须类似,不能设置 type ,也不能是 content: URI. 设置了 type 而没设 scheme :将匹配上没有 URI 的 intent ,或者 content:,file: 的 uri 。设置了 authority: 必须指定一个或多个相关联的 schemes 设置了 path :唏嘘指定一个或多个相关联的 schemes 匹配规则: IntentFilter 匹配 Intent 的上的条件: Action : 值相同, 或则 IntentFilter 未指定 action. DataType:. 系统通过调用 (ContentResolver) 获取 type ,通配符* 在 Intent/IntentFilter 的 MIME type 中使用,区分大小写 DataScheme :系统通过调用 Intent. getData() and ()) 获取 scheme, 区分大小写 DataAuthority: 必须有一个 dataScheme 匹配上且 authority 值匹配上,或者 IntentFilter 没有定义。 Intent. getData() and () 获取 authority. DataPath: scheme and authority 必须先匹配上 ntent. getData() and (), 获取. 或者 IntentFilter 没有定义 Categories : all of the categories in the Intent match categories given in the filter 多余的 Categorie ,不影响 intent 匹配,如果 IntentFilter 没有指定 Categorie ,则只能匹配上没有 Categorie 的 intent 。常用 intent 列表: Android Intent 用法汇总显示网页- <activity android:name="BrowserActivity" android:label="Browser" android:launchMode="singleTask" android:alwaysRetainTaskState="true" android:configChanges="orientation|keyboardHidden" android:theme="***@style/Browser
Intent和intent-filter用法 来自淘豆网www.taodocs.com转载请标明出处.