Skip to content

Instantly share code, notes, and snippets.

@nickfox
Created February 8, 2011 07:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickfox/816045 to your computer and use it in GitHub Desktop.
Save nickfox/816045 to your computer and use it in GitHub Desktop.
// put this in your activity
@Override
protected Dialog onCreateDialog(int id) {
if(id == ID_DIALOG_VALIDATE){
ProgressDialog registerDialog = new ProgressDialog(this);
registerDialog.setMessage(getString(R.string.alert_registering_phone));
registerDialog.setIndeterminate(true);
registerDialog.setCancelable(true);
return registerDialog;
}
return super.onCreateDialog(id);
}
// and in AsyncTask
protected void onPreExecute() {
Log.d(TAG2, "Entered onPreExecute()");
activity.showDialog(activity.ID_DIALOG_VALIDATE);
}
protected void onPostExecute(Void unused) {
Log.d(TAG2, "Entered onPostExecute()");
try {
activity.dismissDialog(activity.ID_DIALOG_VALIDATE);
} catch (IllegalArgumentException e) {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment