android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
来源:互联网 发布:网络水军招募 编辑:程序博客网 时间:2024/05/16 11:51
Error:
android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
此情况出现在android不同版本上。
描述:
项目开始在4.0.1版本上运行没问题,后来在2.3.4版本上测试报出这个异常。异常是由点击spinner弹出框时抛出的。
由于我的spinner是通过
LayoutInflater inflater =(LayoutInflater)getApplication().getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.custom_layout,(ViewGroup)findViewById(R.id.custom_layout_root));
spinner = (Spinner)layout.findViewById(R.id.custom_layout_spinner); 获取的。
然后在2.3.4版本上运行时抛出以上异常。
解决方法:
LayoutInflater inflater=
(LayoutInflater) getApplication().getSystemService(LAYOUT_INFLATER_SERVICE);
just replace that with the version below, since you're launching the AlertDialog
from anActivity
LayoutInflater inflater =
(LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window — token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- 批处理替换文件内容
- 均衡服务器开发自测完毕
- objective-c 中随机数的用法
- Linux .o a .so .la .lo的区别及libtool相关介绍
- xcode升级到4.5遇到的问题
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- poco库学习笔记(3) 加载配置文件
- 织梦搜索页面打开很慢的原因
- 求助:一种数独解法 我运行100多个小时都没运行出结果(已解决)
- 备份sd卡上的操作系统
- 笔试面试题——多线程
- Android中AsyncTask的简单用法
- 该服务器的安全证书尚未生效
- C++ 毫秒时间