AlertDailog: android.view.WindowManager$BadTokenException: Unable to add window -- token null is no

错误内容:AlertDailog:  android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application

 原因:new Dialog(context)在创建Dialog时传递的context不是Context的getApplicationContext,而是Activity的context对象
解决方案:传递参数getApplicationContext()改为Activity类名.this,

 

 

我的QQ群:373643359,欢迎加入

 

AlertDailog: android.view.WindowManager$BadTokenException: Unable to add window -- token null is no,布布扣,bubuko.com

AlertDailog: android.view.WindowManager$BadTokenException: Unable to add window -- token null is no

上一篇:has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@2c58b888 that was original


下一篇:.AppException: android.view.ViewRootImpl$CalledFromWrongThreadException: Only t