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 ...
随机推荐
- 使用python打造一款音乐播放器
作者qq:64761294 编程/考试交流群:834531270 欢迎交流 核心播放模块(pygame内核) import time import pygame import easygui as g ...
- ThinkPHP5.0、5.1和6.0教程文档合集(免费下载)
我们都知道ThinkPHP是一个免费开源的,快速.简单的面向对象的轻量级PHP开发框架. ThinkPHP6主要更新了什么呢? 1. 支持PHP最新的强类型 2. PSR开发规范得了更广泛的应用 3. ...
- 为什么我推荐Nginx作为后端服务器代理
1. 前言 我们真实的服务器不应该直接暴露到公网上去,否则更加容易泄露服务器的信息,也更加容易受到攻击.一个比较"平民化"的方案是使用Nginx反向代理它.今天就来聊一聊使用Ngi ...
- jmeter接口测试 -- 上传文件(multipart/form-data数据请求)
一.环境 jmeter5.2.1 二.具体步骤 1.抓取接口的请求数据 2.填写jmeter的数据 1) 信息头管理器 2) 填写 “参数” 3) 填写 “文件上传” 三.检验接口. 1.响应数据 - ...
- vue学习(十二) 指令v-if v-show 控制页面标签的显示与隐藏
//html <div id="app"> <input type="button" value="toggle" @cl ...
- Android集成Zxing
1.在build文件中添加依赖 dependencies { //ZXing implementation 'com.google.zxing:core:3.3.3' implementation(' ...
- Entry基本用法
1.BooleanVar() 布尔类型 2.IntVar() 整数类型 3.DoubleVar() 浮点数类型 4.StringVar() 字符串类型 5.self.entry1 = Entry(se ...
- python基础day5_元组
元祖---只读列表,可循环查询,可切片 儿子不能改,孙子可能可以改.增加(主要看要操作的是属于列表还是元组) tu = (1,2,3,'alex',[2,3,4,'taibai'],'egon') t ...
- PHP password_verify() 函数
password_verify() 函数用于验证密码是否和散列值匹配. PHP 版本要求: PHP 5 >= 5.5.0, PHP 7高佣联盟 www.cgewang.com 语法 bool p ...
- PHP imagecolorallocate - 为一幅图像分配颜色
imagecolorallocate — 为一幅图像分配颜色.高佣联盟 www.cgewang.com 语法 int imagecolorallocate ( resource $image , in ...