Unable to add window -- token android.os.BinderProxy@XXX is not valid; is your activity running?
来源:互联网 发布:windows平板做点菜系统 编辑:程序博客网 时间:2024/04/29 20:11
错误如下:
01-05 23:15:59.748: E/AndroidRuntime(17418): android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@429de368 is not valid; is your activity running?
01-05 23:15:59.748: E/AndroidRuntime(17418): at android.view.ViewRootImpl.setView(ViewRootImpl.java:559)
01-05 23:15:59.748: E/AndroidRuntime(17418): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:259)
01-05 23:15:59.748: E/AndroidRuntime(17418): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
01-05 23:15:59.748: E/AndroidRuntime(17418): at android.app.Dialog.show(Dialog.java:286)
01-05 23:15:59.748: E/AndroidRuntime(17418): at xxxx.BaseActivity$mHandler.handleMessage(BaseActivity.java:76)
01-05 23:15:59.748: E/AndroidRuntime(17418): at android.os.Handler.dispatchMessage(Handler.java:102)
01-05 23:15:59.748: E/AndroidRuntime(17418): at android.os.Looper.loop(Looper.java:136)
01-05 23:15:59.748: E/AndroidRuntime(17418): at android.app.ActivityThread.main(ActivityThread.java:5047)
01-05 23:15:59.748: E/AndroidRuntime(17418): at java.lang.reflect.Method.invokeNative(Native Method)
01-05 23:15:59.748: E/AndroidRuntime(17418): at java.lang.reflect.Method.invoke(Method.java:515)
01-05 23:15:59.748: E/AndroidRuntime(17418): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:807)
01-05 23:15:59.748: E/AndroidRuntime(17418): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:623)
01-05 23:15:59.748: E/AndroidRuntime(17418): at dalvik.system.NativeStart.main(Native Method)
使用情况如下:A和B继承相同的父类Activity,从A跳转到B后,再从B返回到A,在A中使用父类的ProgressDialog时崩溃报错。
这种报错很常见,意思就是说ProgressDialog所依赖的Context不存在了。原因是实例化B时,ProgressDialog也会被实例化,它依赖的context(具体可在ProgressDialog成员变量中找到)是B,从B返回A时我是直接finish的(我考虑的是启动activity时会把activity加入栈中,B退出,就露出了A,就是一个返回的效果)。那么在A中使用ProgressDialog时就会出问题,因为此时的ProgressDialog是B的,但B已经不在了,所以会错。
解决办法,从B返回A时用startActivity()重新生成A。
- 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 android.os.BinderProxy is not valid; is your activity running?
- 【遇见Android bug】Unable to add window -- token android.os.BinderProxy@4396ecc8 is not valid; is your a
- Android问题集(4):Unable to add window -- token android.os.BinderProxy@bf4921f is not valid;
- BadTokenException: Unable to add window -- token android.os.BinderProxy@438e7108 is not valid;
- Unable to add window -- token android.os.BinderProxy@164db98f is not valid解决办法f
- Unable to add window -- token android.os.BinderProxy@bf4921f is not valid
- Unable to add window -- token android.os.BinderProxy@bf4921f is not valid
- 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 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?
- iOS之UITableView的使用——处理选中单元格
- 独木舟上的旅行
- 2015.01.05
- 自定义iOS7导航栏背景,标题和返回按钮文字颜色
- FSP 频谱仪控制交互
- Unable to add window -- token android.os.BinderProxy@XXX is not valid; is your activity running?
- 建站学习(PHP+apache+mysql):3.日志中的字符串处理
- The Zend Framework MVC Architecture
- vs2013英文版asp.net连接mysql
- leetcode:Factorial Trailing Zeroes
- BCB中的TGroupBox---能用它就用吧
- 清除webview cookie
- Objective - C Runtime
- css细节(实习第1天)