Bug2:Activity已经finish了,还调Dialog

当Activity已经Finish了,还弹对话框的话,就会报这个错

创新互联建站是专业的扎鲁特旗网站建设公司,扎鲁特旗接单;提供网站制作、网站设计,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行扎鲁特旗网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!

·        1Caused by: android.view.WindowManager$BadTokenException:Unable to add window -- token android.os.BinderProxy@42b22048 is not valid; isyour activity running?

·        2    atandroid.view.ViewRootImpl.setView(ViewRootImpl.java:541)

·        3    atandroid.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:259)

·        4    atandroid.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)

·        5    at android.app.Dialog.show(Dialog.java:286)

·        6    atcom.mama100.android.member.wxapi.WXPayHelper.showWXPayFailedDialog(WXPayHelper.java:88)

·        7    atcom.mama100.android.member.activities.mothershop.SubmitOrderActivity$3.onCheckStatusResponse(SubmitOrderActivity.java:941)

·        8    atcom.mama100.android.member.wxapi.CheckWXPayStatus$TaskCheckWXPayStatus.handleResponse(CheckWXPayStatus.java:55)

·        9    atcom.mama100.android.member.activities.AsyncReqTask.onPostExecute(AsyncReqTask.java:50)

·        10    at com.mama100.android.member.activities.AsyncReqTask.onPostExecute(AsyncReqTask.java:1)

解决办法 :

在dialog初始化前先加判断

       if (mContext.isFinishing()) {

           return;

                    }


当前标题:Bug2:Activity已经finish了,还调Dialog
文章路径:http://ybzwz.com/article/jhpcoc.html