ActivityThread exception in Android?
I am working on the task of finding a location that is stored in a DB. Then I have to drop the pin in the appropriate place. I made a modification in the Quick Search Box (QSB) to find the database that is in my application. for this QSB performance, I followed the Search Dictionary example in API Demos. when i click the search suggestion it reloads the current activity and drops the contact to it. clicking the Back button in the Local Code window displays the following exception. why it happens. Any ideas?
My Log CAT Value:
05-17 15:16:30.572: ERROR/ActivityThread(17448): Activity com.example.brown.Bru_Maps has leaked IntentReceiver android.net.NetworkConnectivityListener$ConnectivityBroadcastReceiver@432e6360 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-17 15:16:30.572: ERROR/ActivityThread(17448): android.app.IntentReceiverLeaked: Activity com.example.brown.Bru_Maps has leaked IntentReceiver android.net.NetworkConnectivityListener$ConnectivityBroadcastReceiver@432e6360 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher.<init>(ActivityThread.java:748)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.ActivityThread$PackageInfo.getReceiverDispatcher(ActivityThread.java:576)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.ApplicationContext.registerReceiverInternal(ApplicationContext.java:770)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.ApplicationContext.registerReceiver(ApplicationContext.java:757)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.ApplicationContext.registerReceiver(ApplicationContext.java:751)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:290)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.net.NetworkConnectivityListener.startListening(NetworkConnectivityListener.java:138)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at com.google.android.maps.MapActivity.onResume(MapActivity.java:232)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1225)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.Activity.performResume(Activity.java:3559)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2838)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2866)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1819)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.os.Handler.dispatchMessage(Handler.java:99)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.os.Looper.loop(Looper.java:123)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.ActivityThread.main(ActivityThread.java:4203)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at java.lang.reflect.Method.invokeNative(Native Method)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at java.lang.reflect.Method.invoke(Method.java:521)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
05-17 15:16:30.572: ERROR/ActivityThread(17448): at dalvik.system.NativeStart.main(Native Method)
What is Exception Activity Exception in Android? Please, help.
a source to share
I have the same problem and after searching I found this post about the same problem
https://novoda.lighthouseapp.com/projects/63622/tickets/157-leak-receiver-searchresult
this suggests that the problem occurs when using multiple map activities
in your application.
so in the manifest.xml file of my application, I made each map activity in a separate process:
android:process=":p1"
android:process=":p2"
you can find out about this in the Android docs. http://developer.android.com/guide/topics/manifest/activity-element.html#proc
a source to share
You have an answer in the exception log.
Are you missing the call to unregisterReceiver ()?
Have you registered the broadcast receiver in your application? If so, you must call the non-logging registrar before killing your activity.
EDIT
Hello..
I took a look at ConnectivityBroadcastReceiver and I found this discussion.
they have the same problem. Could you post your code?
a source to share
I faced this problem too. For my case, I am using the battery indicator and do not destroy it when onPause () or onDestroy (). It just turned out that the battery indicator is a broadcast receiver.
To solve, I did the following:
@Override
public void onPause()
{
super.onPause();
unregisterReceiver(myBatInfoReceiver);
}
@Override
public void onResume()
{
super.onResume();
registerReceiver(myBatInfoReceiver,
new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
}
a source to share