首页 > 其他 > 详细

自定义的IntentFileter 无法找到activity

时间:2016-03-12 22:33:51      阅读:228      评论:0      收藏:0      [点我收藏+]
<intent-filter >
<action android:name="com.leo.enjoytime.VIEW"/>
</intent-filter>

自定义的IntentFileter出现异常  No Activity found to handle Intent { com.leo.View (has extras) }

结果查资料发现自定义的action同时需要定义category

比如:

<intent-filter >
<action android:name="com.leo.enjoytime.VIEW"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

每一个通过startActivity()方法发出的隐式Intent都至少有一个category,就是 "android.intent.category.DEFAULT",

所以只要是想接收一个隐式Intent的Activity都应该包括"android.intent.category.DEFAULT" category,不然将导致 Intent 匹配失败。

自定义的IntentFileter 无法找到activity

原文:http://www.cnblogs.com/krislight1105/p/5270148.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!