什么是&QUOT的目的; android.intent.category.DEFAULT"?目的、android、QUOT、DEFAULT

由网友(ˇ叢林猛虎)分享简介:什么是在已提交的意图过滤器的类别给予android.intent.category.DEFAULT的目的是什么?这是什么意思? 解决方案 类别用于隐含意图。所以,如果你的活动可能是由一个隐含的意图开始时,没有特定的类别分配给它,它的意图过滤器应包括这一类。(即使你有在意图过滤器其他类别)。如果你确信你的活动必须调用与...

什么是在已提交的意图过滤器的类别给予android.intent.category.DEFAULT的目的是什么?这是什么意思?

解决方案

类别用于隐含意图。所以,如果你的活动可能是由一个隐含的意图开始时,没有特定的类别分配给它,它的意图过滤器应包括这一类。(即使你有在意图过滤器其他类别)。如果你确信你的活动必须调用与任何其他类别不使用默认值。

设置类别为默认值并不意味着该活动将默认使用,当你的应用程序启动。该活动只是说系统的哦,我可以启动,即使启动意图的类别设置为没有的了!

what is the purpose of giving "android.intent.category.DEFAULT" in the category filed of intent filters ? what does it mean?

解决方案

Categories are used for implicit Intents. So, If your Activity might be started by an implicit Intent when no specific category is assigned to it, its Intent filter should include this category.( even if you have other categories in the Intent filter). If you are sure that your activity must be called with any other Category don't use the Default.

Android中的Intent

Setting Category to Default doesn't mean that this Activity will be used by default when your app launches. The Activity just says to system that " Oh I could be started, even if the starter Intent's category is set to Nothing at all ! "

阅读全文

相关推荐

最新文章