BroadCastReceiver---Are you missing a call to unregisterReceiver()?”

大家好,我在学习用eclipse开发Android应用时,发现每个应用退出时都会提示以下内容,这是什么原因: “Activity com.stv.main.CheckUpdateActivity has leaked IntentReceiver [email protected] that was originally registered here. Are you missing a call to unregisterReceiver()?”

你好,在你的这个类里com.stv.main.CheckUpdateActivity注册了广播,必须在页面销毁时进行解注册,需要调用在onDesdroy()方法里调用unregisterReceiver()。

//实例

@Override
 public void onDestroy() {
  // TODO Auto-generated method stub
  Log.i(TAG, "黑名单服务关闭");
  unregisterReceiver(receiver);
  super.onDestroy();
 }

时间: 2024-08-24 01:37:13

BroadCastReceiver---Are you missing a call to unregisterReceiver()?”的相关文章

Are you missing a call to unregisterReceiver()?

<span style="font-family: 'Microsoft YaHei'; white-space: pre-wrap;">出现这个错误是在我在使用动态广播监听短信是否发送成功,正如错误提示所说,我忘了在我的代码中取消注册广播,因为这是动态广播,所以我必须在不需要的时候将这个广播手动注销,否则就会发生如题所示的异常,这个异常的解决办法很简单,就是在动态广播的onReceiver()方法中注销广播,如下代码所示:</span> public void

has leaked IntentReceiver ...that was originally registerd here.Are you missing a call to unregister

今天碰到了这个错误:has leaked IntentReceiver ...that was originally registerd here.Are you missing a call to unregisterReceiver 如图所示: 这个错误的中文意思是,已经溢出了IntentReceiver,你是忘记了调用注销广播的方法吗? 原因所在: 之所以是溢出IntentReceiver,原因是有receiver 被register后没有被unregister,反复几次后造成 inten

ANDROID-当网络发生变化时使用BroadcastReceiver和service通知

Android 中的 Service 按运行地点分类: 1.本地服务(Local) 该服务依附在主进程上, 服务依附在主进程上而不是独立的进程,这样在一定程度上节约了资源,另外Local服务因为是在同一进程因此不需要IPC,也不需要AIDL.相应bindService会方便很多. 主进程被Kill后,服务便会终止. 非常常见的应用如:HTC的音乐播放服务,天天动听音乐播放服务. 2.远程服务(Remote) 该服务是独立的进程, 服务为独立的进程,对应进程名格式为所在包名加上你指定的androi

特殊广播接收者

比如操作特别频繁的广播事件 屏幕的锁屏和解锁 电池电量的变化 这样的广播接收者在清单文件里面注册无效 import android.os.Bundle; import android.app.Activity; import android.content.IntentFilter; import android.view.Menu; public class MainActivity extends Activity { private ScreenReceiver screenReceive

2016-05-08Android之广播+服务上

##1. 广播接收者概念 BroadCastReceiver,是Android四大组件之一.必须注册. 1. 注册方式:1)静态注册2)动态注册 ##2. IP拨号器 有序广播 activity_main.xml <EditText android:id="@+id/et_ipnum" android:layout_width="wrap_content" android:layout_height="wrap_content" andro

[Android Memory] App调试内存泄露之Context篇(下)

转载地址:http://www.cnblogs.com/qianxudetianxia/p/3655475.html 5. AsyncTask对象 我N年前去盛大面过一次试,当时面试官极力推荐我使用AsyncTask等系统自带类去做事情,当然无可厚非. 但是AsyncTask确实需要额外注意一下.它的泄露原理和前面Handler,Thread泄露的原理差不多,它的生命周期和Activity不一定一致. 解决方案是:在activity退出的时候,终止AsyncTask中的后台任务. 但是,问题是如

Android客户端与服务端交互之登陆示例

今天了解了一下android客户端与服务端是怎样交互的,发现其实跟web有点类似吧,然后网上找了大神的登陆示例,是基于IntentService的 1.后台使用简单的servlet,支持GET或POST.这个servlet最终返回给前台一个字符串flag,值是true或false,表示登录是否成功. servlet使用之前需要配置,主义servlet的servlet-name要和servlet-mapping的servlet-name一致,否则找不到路径 我是在myEclipse上创建的一个we

android开发中遇到的问题汇总(五)

127.ANDROID仿IOS时间_ANDROID仿IOS弹出提示框 http://dwtedx.com/itshare_297.html 128. Android TextView drawableLeft 在代码中实现 方法1 Drawable drawable= getResources().getDrawable(R.drawable.drawable); /// 这一步必须要做,否则不会显示. drawable.setBounds(0, 0, drawable.getMinimumWi

ANDROID_MARS学习笔记_S01原始版_013_广播机制二

一.代码1.xml(1)main.xml 1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:orientation="vertical" 4 android:layout_width="fill_pa