打开APP时,出现闪退的情况,查看android studio报错信息,主要为:

Unable to add window -- token android.os.BinderProxy@3a067204 is not valid

原因分析:由于进入APP时会显示一个进度对话框,对话框的初始化必须依赖Activity,但如果对话框的初始化放在Activity的onCreate方法中,那么就会报错。

因为根据Activity的生命周期,onCreate方法执行时,Activity并未创建完毕,对话框所依赖的Activity还不存在,所以此时初始化对话框必然报错。

解决方法:将对话框的初始化放在onStart方法中。onStart方法在onCreate方法之后被调用,或者在Activity从Stop状态转换为Active状态时被调用。

Android Unable to add window -- token android.os.BinderProxy@3a067204 is not valid错误分析记录的更多相关文章

  1. Unable to add window -- token android.os.BinderProxy@3a067204 is not valid错误分析记录

    打开APP时,出现闪退的情况,查看android studio报错信息,主要为: Unable to add window -- token android.os.BinderProxy@3a0672 ...

  2. Xamarin Android.Views.WindowManagerBadTokenException: Unable to add window -- token android.os.BinderProxy

    Android.Views.WindowManagerBadTokenException: Unable to add window -- token android.os.BinderProxy@ ...

  3. bug_ _ android.view.WindowManager$BadTokenException: Unable to add window -- token

    ========4       关于android的一个常见错误:Unable to add window --token is not valid android.view.WindowManage ...

  4. 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 ...

  5. 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 ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. Android - Unable to add window android.view.ViewRootImpl$W@6518342 -- permission denied for window type 2133

    因为跟博主碰到了一样的问题,所以记录一下分析原理 原文链接:https://www.jianshu.com/p/b0364074288a 首先,先介绍下背景环境,第一,是Android7.0,其次,要 ...

随机推荐

  1. session 与 cookie 区别-----https://segmentfault.com/a/1190000013447750?utm_source=tag-newest

    cookie数据存放在客户的浏览器上,session数据放在服务器上. cookie不是很安全,别人可以分析存放在本地的COOKIE并进行COOKIE欺骗考虑到安全应当使用session. sessi ...

  2. 码云私人代码 SSH 设置----https://blog.csdn.net/kkaazz/article/details/78667573

    码云私人代码 SSH 设置 https://blog.csdn.net/kkaazz/article/details/78667573

  3. Leetcode 95.不同的二叉搜索树II

    不同的二叉搜索树2 给定一个整数 n,生成所有由 1 ... n 为节点所组成的二叉搜索树. 示例: 输入: 3 输出: [ [1,null,3,2], [3,2,null,1], [3,1,null ...

  4. Codeforces 158B (数学)

    B. Mushroom Scientists time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

  5. C++ - 一个构造函数调用构造函数的问题

          今天做C++的实验,题目是写一个二维点的类,然后让一个三维点的类继承它然后扩展.题目是一般学面向对象语言的常用例子.       然后遇到一个这样的问题:之前用Java的时候写构造方法的时 ...

  6. nyoj_600_花儿朵朵_201404162000

    花儿朵朵 时间限制:1000 ms  |  内存限制:65535 KB 难度:5   描述 春天到了,花儿朵朵盛开,hrdv是一座大花园的主人,在他的花园里种着许多种鲜花,每当这个时候,就会有一大群游 ...

  7. - > 贪心基础入门讲解一——完美字符串

    约翰认为字符串的完美度等于它里面所有字母的完美度之和.每个字母的完美度可以由你来分配,不同字母的完美度不同,分别对应一个1-26之间的整数. 约翰不在乎字母大小写.(也就是说字母F和f)的完美度相同. ...

  8. Ubuntu 16.04安装设备管理器Hardinfo和lshw设备信息命令

    安装: sudo apt-get install hardinfo 启动: 实际上这些信息都可以通过lshw进行查看,参考:https://linux.die.net/man/1/lshw

  9. Ubuntu 16.04设置开机启动应用程序

    在终端通过以下命令进行设置,Dash已经搜索不到Startup了: gnome-session-properties 或者直接在Dash中搜索:gnome-session

  10. tapset::iosched(3)

    DESCRIPTION This family of probe points is used to probe the IO scheduler activities. It contains th ...