对话框不会显示。 UI线程问题

时间:2011-02-19 20:39:36

标签: android

我有一个在异步回调中实例化的内部类。我想在回调完成时显示一个对话框,所以我在调用异步操作时将处理程序传递给内部类,但是,我得到了:

 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.WindowManagerImpl.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)

1 个答案:

答案 0 :(得分:1)