Android WindowManager$BadTokenException异常

来源:互联网 发布:淘宝打折软件怎么设置 编辑:程序博客网 时间:2024/05/02 02:23
  Andrdoid用仿iphone的TabBar是用TabHost+ActivityGroup来解决的,里面用View堆栈的形式加载Activity,在里面的Activity用AlertDialog对话框是,报异常:“android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@983iefd89 is not valid; is your activity running? ”

把AlertDialog里面的context:xxxActivity.this 改为::“xxxActivity.this.getParent()”就搞定!