I want to display a progress when the application start, then close progress when all data load completely. How can I do that?
+1
A:
Use ProgressDialog to show Progress, Thread to load data and Handler to handle refresh UI.
In onCreate,
mProgressDlg = ProgressDialog.show(this, "App_Name", "Loading data...",
true, false);
new Thread(new Runnable(){
public void run() {
/*Load Data*/
mProgressDlg.dismiss();
hRefresh.sendEmptyMessage(REFRESH);
}
}).start();
Handler hRefresh = new Handler(){
@Override
public void handleMessage(Message msg) {
switch(msg.what){
case REFRESH:
/*Refresh UI*/
break;
}
}
};
bhatt4982
2009-09-22 05:22:04