`
xiaoheliushuiya
  • 浏览: 406593 次
文章分类
社区版块
存档分类
最新评论

Unable to add window -- token null is not for an application

 
阅读更多

Android开发遇到这个错误:

ERROR/AndroidRuntime(247): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application

原因:

在传context的时候用了getApplicationContext()

解决办法

传context的时候使用Activity.this

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics