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" />
相关推荐
超级大只老咪1 天前
快速进制转换
笔记·算法
JMchen1231 天前
现代Android图像处理管道:从CameraX到OpenGL的60fps实时滤镜架构
android·图像处理·架构·kotlin·android studio·opengl·camerax
Fᴏʀ ʏ꯭ᴏ꯭ᴜ꯭.1 天前
Keepalived VIP迁移邮件告警配置指南
运维·服务器·笔记
快点好好学习吧1 天前
phpize 依赖 php-config 获取 PHP 信息的庖丁解牛
android·开发语言·php
是誰萆微了承諾1 天前
php 对接deepseek
android·开发语言·php
ling___xi1 天前
《计算机网络》计网3小时期末速成课各版本教程都可用谢稀仁湖科大版都可用_哔哩哔哩_bilibili(笔记)
网络·笔记·计算机网络
Dxy12393102161 天前
MySQL如何加唯一索引
android·数据库·mysql
中屹指纹浏览器1 天前
中屹指纹浏览器底层架构深度解析——基于虚拟化的全维度指纹仿真与环境隔离实现
经验分享·笔记
Hello_Embed1 天前
libmodbus 移植 STM32(基础篇)
笔记·stm32·单片机·学习·modbus
无聊的小坏坏1 天前
实习笔记:用 /etc/crontab 实现定期数据/日志清理
笔记·实习日记