Skip to content

Instantly share code, notes, and snippets.

@tassioauad
Created November 11, 2016 19:46
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 tassioauad/53051536fbad1c293b104683e9afff31 to your computer and use it in GitHub Desktop.
Save tassioauad/53051536fbad1c293b104683e9afff31 to your computer and use it in GitHub Desktop.
DialogFragment/AlertDialog dismiss automatically on click button
@Override
public void onResume() {
super.onResume();
AlertDialog alertDialog = (AlertDialog) getDialog();
Button okButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
okButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Do your stuff here
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment