ITeye博客

Unable to add window is not valid; is your activity running?

水果硬糖 · 2013-06-25 11:49 · android · 移动开发 · Markdown

郁闷的Bug,终于解决了,分享一下解决方案!

错误:
android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@435def20 is not valid; is your activity running? at android.view.ViewRoot.setView......

发生环境:
在一个tabActivity里面嵌套一个tabAcitivity, 如果在子tabActivity里面显示AlertDialog的话,就会引发此错误。

解决方法:
AlertDialog.Builder(xxx.this) => AlertDialog.Builder(this.getParent())

 

文章引用自:http://macleo.iteye.com/blog/1486684

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。