popwindow不能显示出现WindowManager$BadTokenException

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方法,在控件渲染完毕后再使用

OK了

posted on 2012-07-09 12:59  mk工作室  阅读(1089)  评论(0编辑  收藏  举报

导航