首页 > 代码库 > 隐式Intent找不到Activity:android.content.ActivityNotFoundException
隐式Intent找不到Activity:android.content.ActivityNotFoundException
Here is what i encountered: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=me.waye.intentdemo.intent.action.WAYE_ACTION cat=[me.waye.intentdemo.intent.category.WAYE_CATEGORY] } 在学习隐式启动Activity的时候遇到这个错误,用的书是李刚的疯狂Android讲义,书上没有提到这个问题,通过看文档发现了答案:
Android treats all implicit intents passed to能接受隐式Intent的Activity必须包含android.intent.category.DEFAULT,但LAUNCHER和MAIN例外,可以不用加,也可以加上但没有这个必要。startActivity()
as if they contained at least one category: "android.intent.category.DEFAULT
" (theCATEGORY_DEFAULT
constant). Therefore, activities that are willing to receive implicit intents must include "android.intent.category.DEFAULT
" in their intent filters. (Filters with "android.intent.action.MAIN
" and "android.intent.category.LAUNCHER
" settings are the exception. They mark activities that begin new tasks and that are represented on the launcher screen. They can include "android.intent.category.DEFAULT
" in the list of categories, but don‘t need to.) See Using intent matching, later, for more on these filters.)
隐式Intent找不到Activity:android.content.ActivityNotFoundException
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。