开发者

Dialog won't show. UI Threading issue

I have an inner class that is instantiated inside of a async callback. I would like a display a dialog when the callback completes, so I pass a handler to the inner class when the async operation is called, however, I'm getting:

 02-19 15:33:49.152: ERROR/AndroidRuntime(635): Uncaught handler: thread main exiting due to uncaught exception
    02-19 15:33:49.272: ERROR/AndroidRuntime(635): android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@4322fef0 is not valid; is your activity running?
    02-19 15:33:49.272: ERROR/AndroidRuntime(635):     at android.view.ViewRoot.setView(ViewRoot.java:456)
    02-19 15:33:49.272: ERROR/AndroidRuntime(635):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
    02-19 15:33:49.272: ERROR/AndroidRuntime(635):     at android.view.Window开发者_JAVA百科ManagerImpl.addView(WindowManagerImpl.java:91)
    02-19 15:33:49.272: ERROR/AndroidRuntime(635):     at android.view.Window$LocalWindowManager.addView(Window.java:409)
    02-19 15:33:49.272: ERROR/AndroidRuntime(635):     at android.app.Dialog.show(Dialog.java:238)


This might be relevant to your case: http://dimitar.me/android-displaying-dialogs-from-background-threads/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜