分享一个问题的解决方法IllegalArgumentException: Viewnot attached to window manager
来源:互联网 发布:卫星电视网络在线直播 编辑:程序博客网 时间:2024/06/05 08:19
分享一个问题的解决方法IllegalArgumentException: Viewnot attached to window manager
今天新遇到一个问题,我在当前界面运行程序的时候触发了一个点击事件,弹了个dialog,紧接着我就按了home键,当我再一次进去的时候点击之前的点击时间程序就报错了
报错的类型:
AndroidRuntime: java.lang.IllegalArgumentException: View=DecorView@ba2c0f3[] not attached to window manager
报错的代码:
if(mProgressDialog!=null && mProgressDialog.isShowing()) {
mProgressDialog.dismiss();
}
报错的原因其实是因为我第二次进去的时候之前的activity已经不存在了,所以dismiss的时候就会报这个异常
我的解决方法是把这个判断条件替换成对当前activity的判断
if(getActivity() != null && !getActivity().isFinishing()) {
mProgressDialog.dismiss();
}
这样就解决了!!
第一次写博客,感觉漏洞挺多的,希望大家多多包涵,多多指导!
阅读全文
0 0
- 分享一个问题的解决方法IllegalArgumentException: Viewnot attached to window manager
- illegalargumentexception: view not attached to window manager
- java.lang.illegalargumentexception view not attached to window manager 解决
- java.lang.IllegalArgumentException: View not attached to window manager
- java.lang.IllegalArgumentException: View not attached to window manager
- java.lang.IllegalArgumentException: View not attached to window manager
- java.lang.IllegalArgumentException - not attached to window manager
- java.lang.IllegalArgumentException: View not attached to window manager
- 关于java.lang.IllegalArgumentException: View not attached to window manager 错误的分析
- 关于java.lang.IllegalArgumentException: View not attached to window manager 错误的分析
- 关于java.lang.IllegalArgumentException: View not attached to window manager 错误的分析
- 关于java.lang.IllegalArgumentException: View not attached to window manager 错误的分析
- 关于java.lang.IllegalArgumentException: View not attached to window manager 错误的分析
- 关于java.lang.IllegalArgumentException: View not attached to window manager 错误的分析
- 关于java.lang.IllegalArgumentException: View not attached to window manager 错误的分析
- android笔记之关于java.lang.IllegalArgumentException: View not attached to window manager 错误的分析
- 关于java.lang.IllegalArgumentException: View not attached to window manager 错误的分析
- not attached to window manager
- ios 推送语音播报
- 利用PowerShell脚本获取IIS绑定的网站地址和状态
- 背景图的使用(视频65-79)
- service启动方式
- Scala 中应用 Future 并发编程
- 分享一个问题的解决方法IllegalArgumentException: Viewnot attached to window manager
- android_fragment加载
- 使用servlet+jsp实现简单的网络通信
- springMVC4.3.7整合 swagger2 2.6.1
- NYOJ 括号配对问题(不用栈)
- Ubuntu 16.04下Intel SGX应用程序程序开发——获得OCALL调用的返回值
- overflow滚动条无效
- 带你一起探究Retrofit 源码,让你不再畏惧Retrofit的面试提问
- 设计模式——享元模式