add application window with unknown token XXX Unable to add window;is your activity is running?
报错:
Attempted to add application window with unknown token XXX
Unable to add window——token android.os.BinderProxy@196e65b8 is not valid;is your activity is running?
原因:
网上很多前辈都说是要传入当前的Activity, 而不是传getAppicationContext,但是检查自己的代码发现,传入的确实是当前的Activity,心都要凉一半,因为周五了,一切顺利的快要下班前一刻,出现这种小问题造成大bug,太sad了。
网上搜索有一篇也是和我情况类似的,但是说了好多,最后没有贴出解决方法,对于小白的我,emmmm,一言难尽。
而后想到,是不是没有在Activity的生命周期最后干掉dialog,于是马上行动,解决了自己的bug,开心愉快高兴~
解决方法:
在Activity的onDestroy方法里关闭弹窗。
@Override
protected void onDestroy() {
super.onDestroy();
// 关闭弹窗
DialogUtils.isShow(); }
public static void isShow(){
try {
if (BUILDER != null)
{
BUILDER=null;
}
if (CUS_DIALOG!=null) {
CUS_DIALOG.cancel();
CUS_DIALOG.dismiss();
CUS_DIALOG = null;
dialogs.dismiss();
}
} catch (Exception e) {
e.printStackTrace();
}
}
若有问题,欢迎各位大佬指教~
add application window with unknown token XXX Unable to add window;is your activity is running?的更多相关文章
- bug_ _ android.view.WindowManager$BadTokenException: Unable to add window -- token
========4 关于android的一个常见错误:Unable to add window --token is not valid android.view.WindowManage ...
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
原博客地址:http://aijiawang-126-com.javaeye.com/blog/662336 在Activity中newSpinner是我把mContext传入,但是出了 andr ...
- Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
在广播中启动一个Dialog时出现如下错误信息:Caused by: android.view.WindowManager$BadTokenException: Unable to add windo ...
- Unable to add window -- token null is not for an application错误的解决方法 android开发
Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not f ...
- android.view.WindowManager$BadTokenException: Unable to add window — token null is not for an applic
之前遇到过这样的问题, 04-12 10:40:33.302: E/AndroidRuntime(17213): Caused by: android.view.WindowManager$BadTo ...
- popupwindow使用之异常:unable to add window -- token null is not valid
使用popwindow中又碰到一个白痴问题,在此留作纪念,希望对大家有帮助 popupwindow之所以叫这个名字,肯定是要从某个地方弹出啦,但是从哪个地方呢?必须是指定一个view嘛 void an ...
- Xamarin Android.Views.WindowManagerBadTokenException: Unable to add window -- token android.os.BinderProxy
Android.Views.WindowManagerBadTokenException: Unable to add window -- token android.os.BinderProxy@ ...
- Activity has leaked window that was originally added -界面退出时未关闭对话框异常 android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running? -
退出Activity时弹出登录框,点击确定finish当前Activity,结果报了这个错,随后查找资料知道 原因: 是因为退出Activity时没有关闭弹出框,出现了这个错误 解决方法: 只需要在a ...
- Unable to add window -- token android.os.BinderProxy@3a067204 is not valid错误分析记录
打开APP时,出现闪退的情况,查看android studio报错信息,主要为: Unable to add window -- token android.os.BinderProxy@3a0672 ...
随机推荐
- 一步步教你用Prometheus搭建实时监控系统系列(一)——上帝之火,普罗米修斯的崛起
上帝之火 本系列讲述的是开源实时监控告警解决方案Prometheus,这个单词很牛逼.每次我都能联想到带来上帝之火的希腊之神,普罗米修斯.而这个开源的logo也是火,个人挺喜欢这个logo的设计. 本 ...
- Monster Audio 使用教程(一)入门教程 + 常见问题
Monster Audio支持的操作系统: windows 7 64bit 至 windows 10 64bit 受支持的VST: Vst 64bit.Vst3 64bit 受支持的声卡驱动: ASI ...
- Spring事务管理接口定义
Spring事务管理接口介绍 Spring事务管理接口: PlatformTransactionManager: (平台)事务管理器 TransactionDefinition: 事务定义信息(事务隔 ...
- IDEA破解2018年12月
---恢复内容开始--- 首先是这个强大的贡献者: http://idea.lanyus.com/ step1.下载IDEA下载包 https://www.jetbrains.com/idea/dow ...
- Java Web(2)-jQuery上
一.jQuery初体验 使用jQuery给一个按钮绑定单击事件 <!DOCTYPE html> <html lang="en"> <head> ...
- SpringBoot2 整合MinIO中间件,实现文件便捷管理
本文源码:GitHub·点这里 || GitEE·点这里 一.MinIO简介 1.基础描述 MinIO是一个开源的对象存储服务.适合于存储大容量非结构化的数据,例如图片.视频.日志文件.备份数据和容器 ...
- Django开发之模态框提交内容到后台[Object Object]
版本 Python 3.8.2 Django 3.0.6 场景 前端页面:使用bootstrap-table展示后台传入数据,选中多行提交修改,弹出bootstrap模态框 模态框内容:根据选中表格行 ...
- JPA第二天
学于黑马和传智播客联合做的教学项目 感谢 黑马官网 传智播客官网 微信搜索"艺术行者",关注并回复关键词"springdata"获取视频和教程资料! b站在线视 ...
- github提交报错
github正确提交步骤 https://www.cnblogs.com/alex-415/p/6912294.html 可能的错误 提交前没有先pull,主要的原因是在创建repository的时候 ...
- PHP strncmp() 函数
实例 比较两个字符串(区分大小写): <?php高佣联盟 www.cgewang.comecho strncmp("Hello world!","Hello ear ...