Android广播接收器注册问题:Caused by: java.lang.IllegalArgumentException: Receiver not registered
2015-01-08 17:40
686 查看
1、程序中明明使用如下方法进行了广播的注册和解除注册:
但程序运行过程中还是有一下问题:
并出现报错:
后来改成下面方法就可以了:
mContext.registerReceiver(downloadReceiver, filter); mContext.unregisterReceiver(downloadReceiver);
但程序运行过程中还是有一下问题:
android.app.IntentReceiverLeaked: Activity *********** has leaked IntentReceiver *********** that was originally registered here. Are you missing a call to unregisterReceiver()?
并出现报错:
Caused by: java.lang.IllegalArgumentException: Receiver not registered: ***************
后来改成下面方法就可以了:
mContext.getApplicationContext().registerReceiver(downloadReceiver, filter); mContext.getApplicationContext().unregisterReceiver(downloadReceiver);
相关文章推荐
- Android Caused by: java.lang.IllegalArgumentException: column '_id' does not exist
- AndroidStudio启动异常:Caused by: java.lang.IllegalArgumentException: Argument for @NotNull paramet
- Android-广播 BroadcastReceiver-java.lang.IllegalAccessException: access to constructor not allowe
- Caused by: java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting ')' at character position 11
- Android异常总结---E/AndroidRuntime(23439): Caused by: java.lang.IllegalArgumentException: column '_id' d
- Caused by: java.lang.IllegalArgumentException: Result Maps collection does not contain value for com
- Android报错:Caused by: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent
- Android错误总结-E/AndroidRuntime(23439): Caused by: java.lang.IllegalArgumentException: column 'id' d
- Android异常总结---E/AndroidRuntime(23439): Caused by: java.lang.IllegalArgumentException: column '_id' d
- mybatis 报错:Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not cont
- 解决kylin报错:Failed to create dictionary on <db>.<table>, Caused by: java.lang.IllegalArgumentException: Too high cardinality is not suitable for dictionary
- Caused by: java.lang.IllegalArgumentException: Text may not be null
- Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value
- Caused by: java.lang.IllegalArgumentException: addChild: Child name 'localhost' is not unique
- spring aop Caused by: java.lang.IllegalArgumentException: Pointcut is not well-formed: 报错
- [Android]Caused by: java.lang.IllegalArgumentException: Service not registered.md
- Caused by: java.lang.IllegalAccessException: Class ognl.OgnlRuntime can not access a member of class
- Android项目编译的时候出现:Caused by: java.lang.ClassNotFoundException: com.example.aaa.MainActivity
- Caused by: java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.HEADSET_PLUG
- eclipse中启动Tomcat7 server失败Caused by: java.lang.IllegalArgumentException: The servlets named...