论坛首页 移动开发技术论坛

token null is not valid; is your activity running?异常解决

浏览 7296 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2011-11-08  

 

popuwindows使用时出现异常:

android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?

解决方法: 
应把pop.showAtLocation(parent, Gravity.TOP,0, 0)这一句移出oncreate方法,在控件渲染完毕后再使用

参考:http://multiarrow.iteye.com/blog/1158492

 

AlertDialog也会有类似问题 参见:

http://pangaoyuan.iteye.com/blog/1086374

论坛首页 移动开发技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics