IntentFilter笔记

一、action

  1. <intent-filter>中可以有多个action,Intent只要匹配其中1个action即匹配成功
  2. <intent-filter>没有action,任何Intent无法与之匹配
  3. <intent-filter>中有action,Intent中没有action时可以与之匹配成功
  4. <intent-filter>中有action,Intent中也有action时,必须命中<intent-filter>中的一个action才能匹配成功

Intent中的action必须命中<intent-filter>中的一个action,才能匹配成功。Intent无action时匹配成功。

二、category

<intent-filter>中可以有多个category,Intent也可以有多个category

  1. 如果<intent-filter>不存在category,那么所有的intent都无法通过。
  2. 如果<intent-filter>存在category,如果Intent中不存在存在category,可以通过。
  3. 如果Intent中存在category,那么Intent中的所有category都包含在<intent-filter>中,才可以通过。

android.intent.category.DEFAULT:

Android把所有传给startActivity()的隐式意图当作他们包含至少一个类别:"android.intent.category.DEFAULT",因此,想要接收隐式意图的活动必须在它们的意图过滤器中包含"android.intent.category.DEFAULT"。

android.intent.category.BROWSABLE

三、data

首先<intent-filter>可以有多个data,Intent最多能有1个data。

<intent-filter>和Intent中的data必须完全匹配才能通过,也适用于通配符。

XML 复制代码
<data android:mimeType="text/plain"
   android:host="www.xxx.com"      
   android:path="/aa/bb"
   android:pathPattern="/b/*" 
   android:port="80"
   android:scheme="http" />
相关推荐
用户693717500138411 分钟前
用上 AI 之后,Android 的边界确实在消失,但我的活反而变多了
android·人工智能·ai编程
AI2中文网25 分钟前
App Inventor 做的表单怎么导出 PDF?WebViewer + JavaScript 在本地生成并保存 PDF 的完整示例
android·开发语言·javascript·pdf·鸿蒙·app inventor
安教安全员通关宝34 分钟前
学习笔记:安全员A证、B证、C证的区别与适用岗位
笔记·学习·安全·题库·安全员c·安全员考试
应用市场1 小时前
安卓底层拆解(二)· 改成 user 版为什么开不了机:合成密码与启动状态
android
星夜离尘561 小时前
MATLAB:标定表局部倒退,为什么不能排序?
android·开发语言·matlab
iThinkAi智能体1 小时前
WorkBuddy 写入飞书选题库实战:字段映射、笔记 ID 去重与批量校验
笔记·飞书
StarsGreen1 小时前
Android 12环境下检查v4l2_code的接入方法
android
小白的高手之路2 小时前
【LeetCode 热题 100】560. 和为 K 的子数组|前缀和、哈希表(Python)
数据结构·笔记·python·算法·leetcode·力扣·散列表
ACP广源盛139246256732 小时前
USB3.1 全通道高速信号开关的工程实践——以 LH6828 @ACP为例的选型与调试笔记
笔记·硬件架构·硬件工程·国产芯片
纪念 2293 小时前
C++ 算法模板与错题 模拟(一)
android·c++·算法