2

我正在将我的 android 应用程序与 facebook 链接并调用 Async 任务来验证 fb 用户,然后在处理程序中调用另一个 Async 任务来链接我数据库中的 fb 帐户。在从第二个异步任务接收信息时,我正在显示带有上下文“this”的进程对话框。两个异步任务中也有进程对话框。有时它工作正常,但有时它显示

android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@422608e8 is not valid; is your activity running?

4

1 回答 1

1

This exception occurred while app was trying to notify user from the background thread by opening a Dialog.

However, according to Google Play console, exception occurred very often and seemed very consistent.

You should use the applicationContext instead of passing the activity. Context appContext = this.getApplicationContext(); must go, and instead you use a pointer to the activity you're in.

So wherever you have passed the pointer of activity or this instead try to pass the context.

于 2013-01-29T10:35:13.387 回答