I received this crash report:
java.lang.IllegalArgumentException: View not attached to window manager
at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:395)
at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:239)
at android.view.Window$LocalWindowManager.removeView(Window.java:441)
at android.app.Dialog.dismissDialog(Dialog.java:306)
at android.app.Dialog.access$000(Dialog.java:89)
at android.app.Dialog$1.run(Dialog.java:132)
at android.app.Dialog.dismiss(Dialog.java:296)
at ZhuangDictActivity$1.onPageFinished(ZhuangDictActivity.java:311)
at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:299)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:4385)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
at dalvik.system.NativeStart.main(Native Method)
Line 311 in ZhuangDictActivity is searchProgressDialog.dismiss() below:
public void onPageFinished(WebView view, String url) {
searchProgressDialog.dismiss();
onConfigurationChanged(ZhuangDictActivity.this.getResources().getConfiguration());
super.onPageFinished(view, url);
}
This is the ProgressDialog.show:
public void onPageStarted(WebView view, String url,
Bitmap favicon) {
searchProgressDialog.setMessage("Loading");
searchProgressDialog.show();
super.onPageStarted(view, url, favicon);
}
The crash occurred when the orientation is changed before the WebView finish loading.
You are simply dismissing, not checking whether it is showing or not. You'll have to check it first:
if (searchProgressDialog != null && searchProgressDialog.isShowing()) {
searchProgressDialog.dismiss();
}
Please override the onDestroy method.
@Override
protected void onDestroy() {
super.onDestroy();
if((progressDialog != null) && progressDialog.isShowing() ){
progressDialog.dismiss();
}
}
Its is because you are trying to show progress dialog ,but at that moment your activity seems to be destroy...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With