is not valid; is your activity running?
2013-11-19 17:05
281 查看
Anroid 异常:is not valid; is your activity running?
今天下午碰到一个很蹊跷的异常:android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@438e7108 is not valid; is your activity running?
其实感到蹊跷的并不是因为异常本身。因为这个异常的提示的很明显,就是代码中调用了一个已经finish的activity。一般用这个activity来弹出对话框。
而真正令我感到迷惑的是:我在onCreate方法中保存了一个静态的Activity实例;
当程序按back后再进入,此时用这个instance实例来启动对话框就会出错。
于是,我在Activity onDestroy的时候把这个静态的实例置为null,这样实例就是活动的实例,没有被finish。问题得到解决。
但是如果不这样做,instance将不会被重新创建。不知为何。
今天下午碰到一个很蹊跷的异常:android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@438e7108 is not valid; is your activity running?
其实感到蹊跷的并不是因为异常本身。因为这个异常的提示的很明显,就是代码中调用了一个已经finish的activity。一般用这个activity来弹出对话框。
而真正令我感到迷惑的是:我在onCreate方法中保存了一个静态的Activity实例;
当程序按back后再进入,此时用这个instance实例来启动对话框就会出错。
于是,我在Activity onDestroy的时候把这个静态的实例置为null,这样实例就是活动的实例,没有被finish。问题得到解决。
但是如果不这样做,instance将不会被重新创建。不知为何。
相关文章推荐
- Anroid 异常:is not valid; is your activity running?
- popupwindow使用之异常-Unable to add window -- token null is not valid; is your activity running?
- 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? -
- token null is not valid; is your activity running?解决方案
- Anroid 异常:is not valid; is your activity running?
- [报错]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 null is not valid; is your activity running?
- is not valid; is your activity running?异常
- Unable to add window -- token android.os.BinderProxy@XXX is not valid; is your activity running?
- Anroid 异常:is not valid; is your activity running?
- Anroid 异常:is not valid; is your activity running?
- 开发中碰到的问题:token null is not valid; is your activity running?
- 错误 $LocalActivityRecord@40533030 is not valid; is your activity running?
- Unable to add window -- token null is not valid; is your activity running?
- Android运行异常一:token android.os.BinderProxy@438e7108 is not valid; is your activity running?
- Unable to add window is not valid; is your activity running?
- Unable to add window -- token android.os.BinderProxy@xxx is not valid; is your activity running
- BadTokenException:Unable to add window …… is your activity running?is not valid; is your activity ru
- Android 后台线程弹对话框导致程序崩溃(is not valid; is your activity running)