android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
来源:互联网 发布:python quants 编辑:程序博客网 时间:2024/04/29 20:37
弹dialog是出现如下错误:
其中context是通过getApplicationContext()获取的,将其换成Activity.this,问题解决
08-25 18:11:01.970: E/AndroidRuntime(24561): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application08-25 18:11:01.970: E/AndroidRuntime(24561): at android.view.ViewRootImpl.setView(ViewRootImpl.java:589)08-25 18:11:01.970: E/AndroidRuntime(24561): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:326)08-25 18:11:01.970: E/AndroidRuntime(24561): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:224)08-25 18:11:01.970: E/AndroidRuntime(24561): at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:149)08-25 18:11:01.970: E/AndroidRuntime(24561): at android.app.Dialog.show(Dialog.java:293)08-25 18:11:01.970: E/AndroidRuntime(24561): at com.ttdevs.easysecuritysmartbar.StartHandler.handleMessage(StartHandler.java:39)08-25 18:11:01.970: E/AndroidRuntime(24561): at android.os.Handler.dispatchMessage(Handler.java:99)08-25 18:11:01.970: E/AndroidRuntime(24561): at android.os.Looper.loop(Looper.java:137)08-25 18:11:01.970: E/AndroidRuntime(24561): at android.app.ActivityThread.main(ActivityThread.java:4866)08-25 18:11:01.970: E/AndroidRuntime(24561): at java.lang.reflect.Method.invokeNative(Native Method)08-25 18:11:01.970: E/AndroidRuntime(24561): at java.lang.reflect.Method.invoke(Method.java:511)08-25 18:11:01.970: E/AndroidRuntime(24561): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)08-25 18:11:01.970: E/AndroidRuntime(24561): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)08-25 18:11:01.970: E/AndroidRuntime(24561): at dalvik.system.NativeStart.main(Native Method)
AlertDialog dialog = new AlertDialog.Builder(context).setTitle(title).setCancelable(false).setPositiveButton("确定", listener).create();
其中context是通过getApplicationContext()获取的,将其换成Activity.this,问题解决
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window — token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- CentOS 6中vsFTPd安装及配置
- NYOJ题目358 取石子(五)hdu题目2516 取石子游戏 Fibonacci’s Game(斐波那契博弈)
- mysql新建数据库和MyEclipse字符集设置
- ACM暑假培训总结
- 周易全文及白话翻译
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- Linux平台gcc和动态共享库的基础知识
- Google的一个面试题——数组原地置换
- wordpress简易安装过程&开启端口
- struts2自定义拦截器
- C++ 虚函数表解析
- 什么是.NET?什么是CLI?什么是CLR?IL是什么?JIT是什么,它是如何工作的?GC是什么,简述一下GC的工作方式?
- NYOJ题目585 取石子(六)hdu 题目1850Being a Good Boy in Spring Festival 尼姆博奕(Nimm Game)
- 将jpg/jpeg文件转换为eps格式,在latex文档中插入eps