····BadTokenExceptionn: Unable to add window··· is your activity running?···

05-28 09:17:01.323: E/AndroidRuntime(13380): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.lonuery.jpush/···.main.MainActivity}: android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@41580330 is not valid; is your activity running?

偶尔会出现这样的问题,有时又会自己好了···烦恼了好半天有时变量被重置也会伴随这个异常····百度又百度了一下,原来是Context的问题,尤其在切换activity的过程中add个dialog或是popwindow啥的,就爱出这个问题。

解决方法,不要用静态这些爱丢的变量,动态获取当前activity作为context.

你可能感兴趣的:(····BadTokenExceptionn: Unable to add window··· is your activity running?···)