WindowManager$BadTokenException:Unable to add window--token null is not for an application
来源:互联网 发布:c语言 libevent 编辑:程序博客网 时间:2024/04/30 04:15
在创建一个AlertDialog的时候,遇见一个异常:WindowManager$BadTokenException:Unable to add window--token null is not for an application
导致报这个错的原因在于new AlertDialog.Builder(mcontext),虽然AlertDialog.Builder aBuilder= new Builder(Context context)的参数是 context,但是不能通过getApplicationContext()获取context,必须使用Activity,因为只有一个Activity才能添加一个窗体。即new AlertDialog.Builder(Activity.this)
0 0
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
- WindowManager$BadTokenException: Unable to add window -- token null is not for an application
- 【转】WindowManager$BadTokenException: Unable to add window -- token null is not for an application
- WindowManager$BadTokenException:Unable to add window--token null is not for an application
- 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 app
- 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 applic
- 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
- 莫队(支持修改)算法
- 轻松理解MYSQL MVCC 实现机制
- android中CoordinatorLayout结合TollBar自定义View的使用效果
- [ IP forward ] with Android 4.0 don't work
- 开发运维工具组件介绍
- WindowManager$BadTokenException:Unable to add window--token null is not for an application
- Struts2 validation验证失败之后s:select的list返回不了的解决
- 盒子模型
- 用JS改变CSS样式
- python 正则匹配
- 常见设计模式之单例模式(Singleton)
- OOM的一些理解与处理
- SpringMvc注解方式开发入门
- IOS-Frameworks-UIKit-UIView.h-frame属性和bounds属性