Skip to content

Instantly share code, notes, and snippets.

@antew
Created February 17, 2013 16:44
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 antew/4972181 to your computer and use it in GitHub Desktop.
Save antew/4972181 to your computer and use it in GitHub Desktop.
/**
* We have to override setOnShowListener here (min API level 8) in
* order to validate the inputs before closing the dialog. Just
* overriding setPositiveButton closes the automatically when the
* button is pressed
*
* @return The onShowListener for the AlertDialog
*/
@Override
public void onShow(DialogInterface dialog) {
Button login = ((AlertDialog) dialog)
.getButton(AlertDialog.BUTTON_POSITIVE);
login.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
doLogin();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment