Created
December 18, 2013 10:21
-
-
Save dominicthomas/8020137 to your computer and use it in GitHub Desktop.
Create a simple positive/negative dialog builder... can be extended by passing in message, yes & no text and callback interfaces....
This file contains hidden or 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
// pass in values as arguements if required... | |
private AlertDialog.Builder getSimpleDialogBuilder() { | |
return new AlertDialog.Builder(this) | |
.setMessage(getString("Some message here")) | |
.setCancelable(true) | |
.setPositiveButton("Yes", | |
new DialogInterface.OnClickListener() { | |
public void onClick(DialogInterface dialog, int id) { | |
// do something | |
} | |
}) | |
.setNegativeButton("Cancel", | |
new DialogInterface.OnClickListener() { | |
public void onClick(DialogInterface dialog, int id) { | |
dialog.cancel(); | |
} | |
}); | |
} | |
AlertDialog.Builder myDialog = getSimpleDialogBuilder(); | |
myDialog.show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment