您的位置:首页 > 移动开发

android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli

2013-09-04 11:52 786 查看
Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application

解决

1.我的mProgressDialog是在线程里的通过Handle去更新,消息不会是null;

2.开始怀疑context对象的问题,将context由activity提升是application,现象还是一样。

3.怀疑view,应该是windowManager.layoutParams中应该缺少什么参数,没错,windowManager.layoutParams中不能没有type的参数,添加mProgressDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);

程序正常运行!!!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐