DESCRIPTION: android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@424ce168 is not valid; is your activity running?
at android.view.ViewRootImpl.setView(ViewRootImpl.java:646)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:248)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at android.app.Dialog.show(Dialog.java:281)
at android.app.Activity.showDialog(Activity.java:3135)
at android.app.Activity.showDialog(Activity.java:3085)
at com.zl.upgrade.activity.s.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5320)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
暂不明原因!
临时解决方案:
在onCreateDialog()中创建dialog的时候,传入最外层的ActivityGroup
20131015
初步原因:
当请求服务器的时候,后台线程返回数据时,调用了activity的showDialog(),但是这个时候恰巧
activity已经被finish掉了,导致报错
Unable to add window -- token android.os.BinderProxy@424ce168 is not valid; is your activity running?
解决办法:在showDialog之前 判断activity是否被finish掉, activity.isFinishing()
参考文章: