android spinner点击android.view.WindowManager$BadTokenException: Unable to add window token is not va
来源:互联网 发布:mac百度云怎么分享链接 编辑:程序博客网 时间:2024/05/01 19:43
当主界面是一个TabActivity,其中底部有4个ActivityGroup,然后在ActivityGroup跳转到另外一个Activity上面使用Spinner。
处理过这个问题的人,都应该知道,Spinner可以显示,但是点击Spinner之后,就会报错。。。
信息如下:
android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@44f1f3a8 is not valid; is your activity running?
但是百度之后,基本没有解决的方法。。。
之后在google之后,终于到了解决方案:
在Activity的oncreate()方法里面:
把this.setContentView(R.layout.XXXXX);修改为:
View viewToLoad = LayoutInflater.from(this.getParent()).inflate(R.layout.XXXXX, null);this.setContentView(viewToLoad);
在把
修改为:ArrayAdapter<CharSequence> spinneraAdapter = ArrayAdapter.createFromResource(getParent(), R.array.wishclassfiy,android.R.layout.simple_spinner_item);
ArrayAdapter<CharSequence> spinneraAdapter = ArrayAdapter.createFromResource(this , R.array.wishclassfiy,android.R.layout.simple_spinner_item);
- android spinner点击android.view.WindowManager$BadTokenException: Unable to add window token is not va
- android spinner点击android.view.WindowManager$BadTokenException: Unable to add window token is not va
- android spinner点击android.view.WindowManager$BadTokenException: Unable to add window token is not va
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is yo
- android.view.WindowManager$BadTokenException:Unable to add window --token is not valid; is your acti
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is yo
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is yo
- Android报错android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
- 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 app
- 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
- Linux C多线程编程
- 与文字相拥 舞尽人间芳华
- 中国知名IT企业的资料
- 简单的比较C语言下交换a,b数值的代码效率
- Intent 和 Intent Filter
- android spinner点击android.view.WindowManager$BadTokenException: Unable to add window token is not va
- struts多文件上传(1)
- 使用VAssistX为VS2008 c++代码添加函数头注释
- 运行mongoose的链接库问题
- 现在是双核时代了,两个人奋斗才叫生活!
- 利用Lucene制作搜索模块的思路及代码说明
- SWUN 调戏
- struts2多文件上传(2)
- 尕福(散文)