android.app.IntentReceiverLeaked:活动 com.example.brown

发布于 2024-09-24 07:49:48 字数 1240 浏览 0 评论 0原文

朋友们 , 我在地图视图中面临问题,最初我有地图视图,标题中带有搜索选项,用于搜索我正在使用的内容 这是我的搜索代码...

Intent intent = getIntent();

        findViewById(R.id.map_search).setOnClickListener(

                    new OnClickListener() {
                        public void onClick(View v) {

                        onSearchRequested();
                        }
                    });

单击它后,将执行下面的代码

       if (Intent.ACTION_VIEW.equals(intent.getAction())) {
            //              
            word = intent.getDataString();

            Log.v("Search2", word);
            Cursor c = managedQuery(Constants.CONTENT_URI_MAPS, null,
                    Constants.BNAME + "='" + word + "'", null,                         null);

--------------

} 我在这里从数据库获取搜索列表数据。 搜索选项提供了搜索地图结果,并且在搜索页面中,标题中再次有搜索选项,并具有后退按钮,当从 UI 或设备单击后退按钮时,它会很好地返回到上一个地图视图,并在第一个地图视图中再次返回按钮,当单击返回时抛出 Activitythread 异常, 09-16 16:04:17.088: ERROR/ActivityThread(425): Activity com.example.brown.Bru_Maps_Result 已泄露最初在此处注册的 IntentReceiver android.net.NetworkConnectivityListener$ConnectivityBroadcastReceiver@43898578。您是否错过了对 unregisterReceiver() 的调用? 我想我必须重写 Onpause()、OnReceive() 方法,但我不知道如何实现它。帮助我解决这个问题。

friend's ,
I'm facing the problem in map view,initially i have map view with search option in header for searchin up content i'm using
here my code for search...

Intent intent = getIntent();

        findViewById(R.id.map_search).setOnClickListener(

                    new OnClickListener() {
                        public void onClick(View v) {

                        onSearchRequested();
                        }
                    });

after clicking it the code below is executed

       if (Intent.ACTION_VIEW.equals(intent.getAction())) {
            //              
            word = intent.getDataString();

            Log.v("Search2", word);
            Cursor c = managedQuery(Constants.CONTENT_URI_MAPS, null,
                    Constants.BNAME + "='" + word + "'", null,                         null);

--------------

}
where here i fetch search list data from database.
search option provides search map result has well and in search page there again search option in header and have back button ,when click back button either from UI or device it backs well to previous mapview and again back button in first mapview,when click back it throws an Activitythread exception,
09-16 16:04:17.088: ERROR/ActivityThread(425): Activity com.example.brown.Bru_Maps_Result has leaked IntentReceiver android.net.NetworkConnectivityListener$ConnectivityBroadcastReceiver@43898578 that was originally registered here. Are you missing a call to unregisterReceiver()?
i think i have to override Onpause(),OnReceive() methods,but i dont know how to implement it.help me to fix this issue.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

森末i 2024-10-01 07:49:48

在某个地方,您没有为相应的“registerReceiver”调用调用“unRegisterReceiver”方法。

调用 registerReceiver API 来监听广播意图,您可以检查一下您的代码中是否这样做了?

Somewhere you are not calling "unRegisterReceiver" method for a corresponding "registerReceiver" call.

registerReceiver API is called for listening for a broadcast intent, Can you check whether you are doing that in your code?

享受孤独 2024-10-01 07:49:48

我确信您忘记了 unregisterReceiver()

不过,如果您在 Activity.onResume() 实现中注册接收器,则应该在 Activity 中取消注册它。 onPause()。
这样,您在暂停时就不会收到意图,这将减少不必要的系统开销。

I am sure you are forget to unregisterReceiver()

Although, If you registering a receiver in your Activity.onResume() implementation, you should unregister it in Activity.onPause().
That way you won't receive intents when paused, and this will cut down on unnecessary system overhead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文