关于写一个android应用时抛出的一个异常,很奇怪,无法解决!
android.view.WindowManager$BadTokenException:Unabletoaddwindow--tokenandroid.os.Binde...
android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@412ae140 is not valid; is your activity running?at android.view.ViewRootImpl.setView(ViewRootImpl.java:513)at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:301)at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:215)at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:140)at android.view.Window$LocalWindowManager.addView(Window.java:537)at android.app.Dialog.show(Dialog.java:278)at com.iotek.foreignexchange.ForeignExchangeActivity$FEHandler.handleMessage(ForeignExchangeActivity.java:314)at android.os.Handler.dispatchMessage(Handler.java:99)at android.os.Looper.loop(Looper.java:137)at android.app.ActivityThread.main(ActivityThread.java:4424)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:784)at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)at dalvik.system.NativeStart.main(Native Method)抛出的异常,网上搜到两种解决方法,1.把XXXActivity.this 改成XXXActivity.this.getParent();直接抛出NullPointException;2.把出错的Dialog在onDestroy() 方法里置空;以上两种方法都不对!
展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询