gpt4 book ai didi

android - Android AsyncTask 的 OnCancelled() 错误

转载 作者:行者123 更新时间:2023-11-29 01:29:20 26 4
gpt4 key购买 nike

我在 AsyncTask 的 OnCancelled() 方法中发现错误,错误如下:

Exception of type 'Java.Lang.IllegalArgumentException' was thrown.

java.lang.IllegalArgumentException: View=com.android.internal.policy.impl.PhoneWindow$DecorView{41b1e790 V.E..... R.....ID 0,0-456,144} not attached to window manager

我在 OnCancelled() 中使用的代码是:

if (progressDialog != null)
{
if (progressDialog.IsShowing == true)
progressDialog.Dismiss();
}

最佳答案

如果在 AsyncTask 的 onCancelled 事件触发时您的 View 已经被销毁,就会发生这种情况。 Look at this SO question

关于android - Android AsyncTask 的 OnCancelled() 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32154780/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com