@Override protected Dialog onCreateDialog(int id) { switch (id) { case PROGRESS_DIALOG: progressDialog = new ProgressDialog(D4.this); progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); progressDialog.setMessage("Loading..."); return progressDialog; default: return null; } }
@Override protected void onPrepareDialog(int id, Dialog dialog) { switch (id) { case PROGRESS_DIALOG: progressDialog.setProgress(0); progressThread = new ProgressThread(handler); progressThread.start(); } }
@Override public void handleMessage(Message msg) { int total = msg.arg1; progressDialog.setProgress(total); if (total >= 100) { dismissDialog(PROGRESS_DIALOG); progressThread.setState(ProgressThread.STATE_DONE); } }