当Activity已经Finish了,还弹对话框的话,就会报这个错
· 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;
}
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。