private ProgressDialog dialog;
public void onCreate(Bundle savedInstanceState) {
……
dialog = ProgressDialog.show(this, "",
"Loading Calendar and Tasks. Please wait...", true);
……
CalendarThread calendarThread = new CalendarThread();
calendarThread.start();
}
private class CalendarThread extends Thread {
@Override
public void run() {
//Long running process
……
handler.sendEmptyMessage(0);
}
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
//Process after the long running process
……
dialog.dismiss();
}
};
}
No comments:
Post a Comment