Last active
May 5, 2016 03:45
-
-
Save rajohns08/e4aacf98726213db2714 to your computer and use it in GitHub Desktop.
Android - ActionAlert dialog for yes/no type of dialog where the user is asked to confirm some action or cancel
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
public class ActionAlert { | |
public static void show(Context context, String title, String message, String actionText, DialogInterface.OnClickListener actionCallback) { | |
new AlertDialog.Builder(context) | |
.setTitle(title) | |
.setMessage(message) | |
.setPositiveButton(actionText, actionCallback) | |
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { | |
@Override | |
public void onClick(DialogInterface dialog, int which) { | |
dialog.cancel(); | |
} | |
}).show(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment