As mentioned in this unanswered question: WebView throws Receiver not registered: android.widget.ZoomButtonsController
By turning the WebView zoom controls on and of
If you are stumbling upon this question, be sure to check the bug report first to see what the status is from Google, but otherwise here is a workaround that is working so far so good for me:
Add this line to your onDestory() method:
webView.getSettings().setBuiltInZoomControls(true);
java.lang.IllegalArgumentException: View not attached to window manager exception mostly occurs when there is a dialog (i.e. Progress Dialog) and you are dismissing it when the Activity has closed. Could you tell if your Activity indeed has a Progress Dialog in it , so that I can continue with my analysis ? Also post your Activity's code snippet which might help us identifying why your app is crashing ...
Also you say you don't face application crash often frequently, so do a test to confirm my suspicions. When your application is running change your screen orientation , and do it a couple of times , after few minutes, preferably when there is Progress Dialog involved in doing some work. It might crash the application which should tell us that the error is because the Progress Dialog isn't dismissing correctly.
My Theory : When you switch orientations, Android will create a new View. You're probably getting crashes because your background thread is trying to change the state on the old one. (It may also be having trouble because your background thread isn't on the UI thread)
This solution works fine, you simply need to remove the webview from the layout before destroying it:
@Override
public void onDestroy() {
if (webView!=null && webView.getParent()!=null){
((ViewGroup)webView.getParent()).removeView(webView);
webView.destroy();
webView=null;
}
super.onDestroy();
}
No handlers, no delays, i think it's the best solution
Add this to your activity:
@Override
public void finish() {
ViewGroup view = (ViewGroup) getWindow().getDecorView();
view.removeAllViews();
super.finish();
}
I have the same issue here: Existent app blowing up with android 3.0 XOOM. ZoomButtonsController Leak?
This happens when there's an exception that happens before registerReceiver is called and then you try to unregisterReceiver later without it ever been registered.
It's probably a android 3.0 bug.
Put this line in onDestroy works for me:
webView.setVisibility(View.GONE);