Created
November 22, 2014 14:24
-
-
Save tobiasstraub/a7039064903886584901 to your computer and use it in GitHub Desktop.
Android: Dialog with positive and negative Button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AlertDialog.Builder builder = new AlertDialog.Builder(getApplicationContext()); | |
builder.setTitle(R.string.dialog_title); | |
builder.setMessage(R.string.dialog_message); | |
builder.setPositiveButton(R.string.dialog_yes, new DialogInterface.OnClickListener() { | |
@Override | |
public void onClick(DialogInterface dialog, int which) { | |
// TODO: Do something, when user click on the positive button | |
} | |
}); | |
builder.setNegativeButton(R.string.dialog_no, new DialogInterface.OnClickListener() { | |
@Override public void onClick(DialogInterface dialog, int which) { | |
// TODO: Do something, when user click on the positive button | |
} | |
}); | |
builder.create().show(); // Create the Dialog and display it to the user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment