Unable to add window -- token null is not valid; is your activity running?
来源:互联网 发布:linux 创建目录 编辑:程序博客网 时间:2024/04/29 21:52
在一个activity的onCreate中写了如下的一段代码:
private final int WATIING_SECS = 5;
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
if (isDialogShowing()) {
dismissWaitDialog();
if(popupwindowQueryState == null
&& ControllerAirPage.this != null
&& rootView != null){
popupwindowQueryState = new GoBackPopupwindow(ControllerAirPage.this,
getString(R.string.time_out),
getString(R.string.air_messge_getting_failed),
true);
popupwindowQueryState.showAtLocation(rootView, Gravity.CENTER, 0, 0);
}
}
}
}, WATIING_SECS * 1000);
大部分时间没有问题,但是当这个popupwindowQueryState没有显示出来,而我直接返回上一页的时候。就会遇到一个报错。
android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
解决方案:
应把应把pop.showAtLocation(parent, Gravity.TOP,0, 0)这一句移出oncreate方法,在控件渲染完毕后再使用.
- PopupWindow出现Unable to add window -- token null is not valid; is your activity running?
- PopWindow Unable to add window -- token null is not valid; is your activity running
- Unable to add window -- token null is not valid; is your activity running?
- - Unable to add window -- token null is not valid; is your activity running?
- Unable to add window -- token null is not valid; is your activity running?
- unable to add window -- token null is not valid; is your activity running 错误解决办法
- PopupWindow出现Unable to add window -- token null is not valid; is your activity running?
- Unable to add window -- token null is not valid; is your activity running?错误及其修改方法
- popupwindow使用之异常-Unable to add window -- token null is not valid; is your activity running?
- Unable to add window — token android.os.BinderProxy is not valid; is your activity running?
- Unable to add window -- token android.os.BinderProxy@XXX is not valid; is your activity running?
- Unable to add window -- token android.os.BinderProxy@xxx is not valid; is your activity running
- Unable to add window — token android.os.BinderProxy is not valid; is your activity running?
- Unable to add window --token is not valid; is your activity running?
- 关于android的一个常见错误:Unable to add window --token is not valid; is your activity running?
- Anroid 异常:Unable to add window …… is not valid; is your activity running?
- Unable to add window is not valid; is your activity running?
- view.WindowManager$BadTokenException: Unable to add window…is not valid; is your activity running?
- 栈应用——平衡符号
- [POJ](3268)Silver Cow Party ---最短路径(图)
- 2017网易前端笔试题总结
- spring-cloud-consumer-hystrix(六)
- Maven打包命令
- Unable to add window -- token null is not valid; is your activity running?
- java 学习笔记之AtomicInteger类的使用
- 无需XML的hibernate
- C语言读取配置文件
- bzoj 4916: 神犇和蒟蒻
- 最近在头痛的协作问题
- Spring与mybatis三种整合方法
- 智能小车九《不学电路图怎么造车》
- 获取系统默认语言