View not attached to window manager
java.lang.IllegalArgumentException: View not attached to window manager
在用ProgressDialog的时候,任务结束后Dismiss对话框,但是如果由于一些原因,此时的activity在progressDialog的 dismiss之前,就给干掉了,就会有这样的错误。那如何正确处理呢?
1. 不要在非UI线程中使用对话框创建,显示和取消对话框
2. 如果一定要异步操作显示对话框怎么办?
Activity都有相应的操作对话框的回调比如onCreateDialog(),showDialog(),dimissDialog(),removeDialog()等等。这些因为都是Activity的方法,所以用起来更方便,也不用显示创建和操控Dialog对象,一切都由框架操控,相对来说比较安全。
另外就是一定要让对话框对象在Activity的可控制范围之内和生命周期之内,比如一定要是它的成员变量,并且在让对话框变量活跃在Activity的onCreate()和onDestroy()之间。
View not attached to window manager的更多相关文章
- bug_ _java.lang.IllegalArgumentException: View not attached to window manager 2
今天遇到一个很奇特的问题,当用户设置了PIN码,在锁屏界面正常解锁PIN码后,进入Launcher时显示com.android.phone 已停止运行.一开始猜想会不会是解锁PIN码的时候处理导致了P ...
- bug_ _java.lang.IllegalArgumentException: View not attached to window manager
============= 1 view not attached to window manager 转自:http://hi.baidu.com/spare_h/blog/item/7fa3e ...
- Android中 View not attached to window manager错误的解决办法
前几日出现这样一个Bug是一个RuntimeException,详细信息是这样子的:java.lang.IllegalArgumentException: View not attached to w ...
- 关于java.lang.IllegalArgumentException: View not attached to window manager 错误的分析
今天遇到一个很奇特的问题,当用户设置了PIN码,在锁屏界面正常解锁PIN码后,进入Launcher时显示com.android.phone 已停止运行.一开始猜想会不会是解锁PIN码的时候处理导致了P ...
- View not attached to window manager crash 的解决办法
View not attached to window manager crash 的解决办法 转自:http://stackoverflow.com/questions/22924825/view- ...
- java.lang.IllegalArgumentException: View not attached to window manager
公司项目线上bug: java.lang.IllegalArgumentException: View not attached to window manager at android.view.W ...
- decorview that was originally added here or java.lang.IllegalArgumentException: View not attached to window manager
使用Dialog的时候,没少出现下面这两个报错 12-11 17:47:49.776: E/WindowManager(11461): android.view.WindowLeaked: Activ ...
- 关于dialog引起的 java.lang.IllegalArgumentException: View=com.android.internal.policy.impl.PhoneWindow$DecorView not attached to window manager 错误的分析
在跑Monkey测试的时候出现了一个比较特别的问题,先来看看Log: // CRASH: com.meizu.media.painter (pid 12491) // Short Msg: java. ...
- view not attached to windows manager与This Toast was not created with Toast.makeText()
http://blog.sina.com.cn/s/blog_474928c90100x871.html public class Ex04_1Activity extends Activ ...
随机推荐
- SQL Server 中创建数据库、更改主文件组示例
以下示例在 SQL Server 实例上创建了一个数据库.该数据库包括一个主数据文件.一个用户定义文件组和一个日志文件.主数据文件在主文件组中,而用户定义文件组包含两个次要数据文件.ALTER DAT ...
- PHP扩展开发(6) - VS2012下strncasecmp和fopen函数warning
1. fopen warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s i ...
- IE下兼容Css+HTML5
/*! HTML5 Shiv vpre3.6 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed Uncompressed source: h ...
- DeDe调用指定栏目ID下的文章
*注: row: 调用条数 titlelen: 字数 typeid: 调用的栏目ID orderby: 按照升序对记录进行排序 idlist: 提取特定文档为空 infolen='40' 内容简介长度 ...
- HTML&CSS基础学习笔记1.26-input重置表单
重置表单 <input>的[type]属性值为"button"的时候表示一个普通的按钮,相当于一个<button>标签. <input>的[ty ...
- Kafka笔记--监控系统KafkaOffsetMonitor
KafkaOffsetMonitor下载链接: http://download.csdn.net/detail/changong28/7930337github官方:https://github.co ...
- iOS开发中文件的上传和下载功能的基本实现-备用
感谢大神分享 这篇文章主要介绍了iOS开发中文件的上传和下载功能的基本实现,并且下载方面讲到了大文件的多线程断点下载,需要的朋友可以参考下 文件的上传 说明:文件上传使用的时POST请求,通常把要上传 ...
- 游览器对js加载的次序
直接看例子 <body> <script> console.log("first"); var script = document.createElemen ...
- linux系统时间和硬件时钟问题(date和hwclock)
http://blog.chinaunix.net/uid-182041-id-3464524.html http://blog.csdn.net/duyiwuer2009/article/detai ...
- linux下如何编译python生成libpython2.5.so动态库
http://biancheng.dnbcw.info/python/245306.html