gpt4 book ai didi

Android ProgressDialog 不显示

转载 作者:行者123 更新时间:2023-11-29 21:52:55 25 4
gpt4 key购买 nike

我创建了一个 AlertDialog让用户选择是否从服务器下载内容。

如果用户选择下载,AlertDialog被解雇,并提出一个ProgressDialog连接到 AsyncTask .

ProgressDialog从未显示。 AlertDialog 的“确定”按钮在 AsyncTask 的操作结束之前保持选中状态.

如果我“评论”AsyncTask运行代码中,AlertDialog被正确解雇,ProgressDialog出现。

我没有在真机上试过这个应用,只在模拟器上试过。

问题是什么?

最佳答案

试试这个代码,这可能对你有帮助

private class allinfo extends AsyncTask<String, Void, JSONObject> {
private ProgressDialog dialog;

protected void onPreExecute(){
dialog = ProgressDialog.show(collection.this, "Loading", "Loading. Please wait...", true,false);
}

@Override
protected JSONObject doInBackground(String... arg0) {
// TODO Auto-generated method stub

return json;
}
protected void onPostExecute(JSONObject json)
{
dialog.dismiss();
info(json);
}

}

关于Android ProgressDialog 不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13993947/

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