码迷,mamicode.com
首页 > 编程语言 > 详细

java.lang.IllegalArgumentException: View not attached to window manager

时间:2016-08-22 12:22:32      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:

公司项目线上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();
    }

 

java.lang.IllegalArgumentException: View not attached to window manager

标签:

原文地址:http://www.cnblogs.com/androidsuperman/p/5794907.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!