什么时候加上android.intent.category.DEFAULT
什么时候加上android.intent.category.DEFAULT
1、要弄清楚这个问题,首先需要弄明白什么是implicit(隐藏) intent什么是explicit(明确) intent。
Explicit Intent明确的指定了要启动的Acitivity ,比如以下Java代码: 
Intent intent= new Intent(this, B.class)
Implicit Intent没有明确的指定要启动哪个Activity ,而是通过设置一些Intent Filter来让系统去筛选合适的Acitivity去启动。
2、intent到底发给哪个activity,需要进行三个匹配,一个是action,一个是category,一个是data。
理论上来说,如果intent不指定category,那么无论intent filter的内容是什么都应该是匹配的。但是,如果是implicit intent,android默认给加上一个CATEGORY_DEFAULT,这样的话如果intent filter中没有android.intent.category.DEFAULT这个category的话,匹配测试就会失败。所以,如果你的 activity支持接收implicit intent的话就一定要在intent filter中加入android.intent.category.DEFAULT。
例外情况是:android.intent.category.MAIN和android.intent.category.LAUNCHER的filter中没有必要加入android.intent.category.DEFAULT,
我们定义的activity如果接受implicit intent的话,intent filer就一定要加上android.intent.category.DEFAULT这个category。
什么时候加上android.intent.category.DEFAULT的更多相关文章
- android之android.intent.category.DEFAULT的用途和使用
		1.要弄清楚这个问题,首先需要弄明白什么是implicit(隐藏) intent什么是explicit(明确) intent. Explicit Intent明确的指定了要启动的Acitivity , ... 
- android.intent.category.DEFAULT
		我们需要什么时候加android.intent.category.DEFAULT呢? 1.要弄清楚这个问题,首先需要弄明白什么是implicit(隐式) intent什么是explicit(显示) i ... 
- android细节之android.intent.category.DEFAULT的使用
		我们知道,实现android的Activity之间相互跳转需要用到Intent, Intent又分为显式Intent和隐式Intent, 显式Intent很简单,比如我在FirstActivity中想 ... 
- [转]理解android.intent.category.LAUNCHER 具体作用
		转自:http://blog.csdn.net/jackrex/article/details/9189657 android.intent.category.LAUNCHER 具体有什么作用?我做一 ... 
- android.intent.category.BROWSABLE
		参考: http://blog.csdn.net/annkie/article/details/8349626 http://xiechengfa.iteye.com/blog/1004991 BRO ... 
- (转)android.intent.action.MAIN与android.intent.category.LAUNCHER
		android.intent.action.MAIN决定应用程序最先启动的Activity android.intent.category.LAUNCHER决定应用程序是否显示在程序列表里 在网上看到 ... 
- android.intent.action.MAIN与android.intent.category.LAUNCHER
		android.intent.action.MAIN 决定应用程序最先启动的Activity android.intent.category.LAUNCHER 决定应用程序是否显示在程序列表里 在网上 ... 
- 理解android.intent.action.MAIN 与 android.intent.category.LAUNCHER
		刚才看了一下sundy的视频<LLY110426_Android应用程序启动>,里面讲到luncher这个activity通过获取应用程序信息来加载应用程序,显示给用户,其中就是通过一个应 ... 
- android.intent.action.MAIN 与 android.intent.category.LAUNCHER 的验证理解 (转)
		原文地址:android.intent.action.MAIN 与 android.intent.category.LAUNCHER 的验证理解 作者: 第一种情况:有MAIN,无LAUNCHER,程 ... 
随机推荐
- salesforce 零基础学习(三十七) DML及Database方法简单描述
			在apex中通过soql查询可以使用两种方式,使用DML语句或者使用Database的方法. 使用DML语句和使用Database类的方法对于我们来说用的都很多,并且都很常见.对于数据库常见的操作:增 ... 
- 关于Thread.currentThread()和this的差异
			重新来看多线程时,被这结果搞懵逼了.不多说,直接上代码: public class MyThread02 extends Thread { public MyThread02() { System.o ... 
- stackView的隐藏与显示注意事项
			1.想要通过变换stackView的y值来让stackView显现/隐藏,同时让其中的button能点击响应,得用topCons 2.导航栏的tinBar要设置为非透明状态 
- linux安装nginx
			nginx启动.重启.关闭 安装: http://www.cnblogs.com/skynet/p/4146083.html 一.启动 cd usr/local/nginx/sbin ./nginx ... 
- Hadoop官方文档翻译——HDFS Architecture 2.7.3
			HDFS Architecture HDFS Architecture(HDFS 架构) Introduction(简介) Assumptions and Goals(假设和目标) Hardware ... 
- Spark入门实战系列--3.Spark编程模型(下)--IDEA搭建及实战
			[注]该系列文章以及使用到安装包/测试数据 可以在<倾情大奉送--Spark入门实战系列>获取 . 安装IntelliJ IDEA IDEA 全称 IntelliJ IDEA,是java语 ... 
- Spark入门实战系列--9.Spark图计算GraphX介绍及实例
			[注]该系列文章以及使用到安装包/测试数据 可以在<倾情大奉送--Spark入门实战系列>获取 .GraphX介绍 1.1 GraphX应用背景 Spark GraphX是一个分布式图处理 ... 
- Hadoop阅读笔记(三)——深入MapReduce排序和单表连接
			继上篇了解了使用MapReduce计算平均数以及去重后,我们再来一探MapReduce在排序以及单表关联上的处理方法.在MapReduce系列的第一篇就有说过,MapReduce不仅是一种分布式的计算 ... 
- Android安装BusyBox(三星N7108)
			近期公司安卓app测试,分配任务为监控APP内存.CPU占用率.因安卓是基于linux开发,故很容易就联想使用Linux监控相关的命令.想法总是美好的,现实总是残酷的,使用三星 Galaxy Note ... 
- Theano入门神经网络(三)
			附录一个:Keras学习随笔 http://blog.csdn.net/niuwei22007/article/details/49045909 参考 <Python Machine Learn ... 
