公司项目线上bug:
java.lang.IllegalArgumentException: View not attached to window manager at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:406) at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:308) at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:79) at android.app.Dialog.dismissDialog(Dialog.java:323) at android.app.Dialog$1.run(Dialog.java:119) at android.os.Handler.handleCallback(Handler.java:730) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5162) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method)
stackoverflow.com上面相关内容:
http://stackoverflow.com/questions/22924825/view-not-attached-to-window-manager-crash
http://stackoverflow.com/questions/2745061/java-lang-illegalargumentexception-view-not-attached-to-window-manager
修改项目里面代码:
protected void startProgressDialog() { // showDialog(DIALOG_PROGRESS); if (progressDialog == null) { progressDialog = CommonDialogUtils.showLoadingDialog(this); } progressDialog.show(); } protected void dismissProgressDialog() { // removeDialog(DIALOG_PROGRESS); if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } }
onDestory中调用dismissProgressDialog
@Override protected void onDestroy() {super.onDestroy(); dismissProgressDialog(); }
时间: 2024-11-15 15:08:59