本文介绍了显示progressdialog而列表视图是加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要显示ProgressDialog而列表视图是加载。我已经尝试过类似下面的代码,但没有奏效。
I want to display ProgressDialog while listview is loading. I've already tried like following coding but it didn't work.
final ProgressDialog dialog = ProgressDialog.show(this, "indeterminate", "Please wait while loading", true);
final Handler handler = new Handler() {
public void handleMessage(Message msg) {
dialog.dismiss();
}
};
Thread checkUpdate = new Thread() {
public void run() {
// listview will be populated here
PopulateListView();
handler.sendEmptyMessage(0);
}
};
checkUpdate.start();
但是,这并不在所有的工作。
But it didn't work at all.
推荐答案
ppshein ......我想你错过了几个电话。
ppshein... I think you are missing a few calls.
1) new Thread( new Runnable() {
2) super.handleMessage
3) switch(msg.what)
我有工作code 在这里。此外AsyncTask的这里
I have working code here.Also AsyncTask here.
这篇关于显示progressdialog而列表视图是加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!