Hello,
I’m having problems with BroadcastReceivers when the screen
orientation changes.
My Activity registers for receiving WiFi scans with a
BroadcastReceiver and when the scan is done: (1)
unregisterReceiver(mWifiReceiver), (2) I made some things with the
results (by using an AsynkTask thread) and finally, when the thread is
finished (3) the activity starts another WiFi scan and the whole
process starts again.
Everything works fine until a screen orientation changes occurs:
If I do not unregisterReceiver() on the
onRetainNonConfigurationInstance method I get this exception
Activity myActivity has leaked IntentReceiver myActivity
$WifiReceiver@405efad0 that was originally registered here. Are you
missing a call to unregisterReceiver()?
While if I unregisterReceiver(), I get this one:
ERROR/AndroidRuntime(1490): java.lang.RuntimeException: Error
receiving broadcast Intent { act=android.net.wifi.SCAN_RESULTS } in
myActivity $WifiReceiver@406b4668
Could someone tell me the correct way to manage BroadcastReceiver in
screen orientation changes?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en