Skip to content

Instantly share code, notes, and snippets.

@nickfox
Created Feb 8, 2011
Embed
What would you like to do?
// 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