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

简介: 公司项目线上bug: java.lang.IllegalArgumentException: View not attached to window manager at android.

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

 

相关文章
|
6月前
|
安全 Java 数据库连接
【Java每日一题】— —第二十六题:编程定义一个经理类Manager。
【Java每日一题】— —第二十六题:编程定义一个经理类Manager。
|
1月前
|
分布式计算 Java 大数据
大数据-122 - Flink Time Watermark Java代码测试实现Tumbling Window
大数据-122 - Flink Time Watermark Java代码测试实现Tumbling Window
34 0
Java学习日志——springmvc中moudle里的数据渲染不进view里
Java学习日志——springmvc中moudle里的数据渲染不进view里
Java学习日志——springmvc中moudle里的数据渲染不进view里
|
Java
Java - Window 下安装 java
Java - Window 下安装 java
144 0
Java - Window 下安装 java
|
Java
Java 开发环境配置-window
想要在自己电脑上运行Java程序,就必须配置响应的Java运行环境,接下来就为大家介绍如何搭建Java开发环境。
278 0
Java 开发环境配置-window
|
jenkins Java 应用服务中间件
Jenkins部署异常: java.io.FileNotFoundException: http://ip:端口/manager/text/list
Jenkins部署异常: java.io.FileNotFoundException: http://ip:端口/manager/text/list
460 0
Jenkins部署异常: java.io.FileNotFoundException: http://ip:端口/manager/text/list
|
Java 应用服务中间件
MyEclipse java开发报“Could not create the view: An unexpected exception was thrown.”错误原因
MyEclipse java开发报“Could not create the view: An unexpected exception was thrown.”错误原因
|
存储 Java 数据安全/隐私保护