Gamebase SDK for Android  1.1.2
Toast Gamebase Platform

◆ showAlertDialog() [2/2]

static void showAlertDialog ( @NonNull final Context  context,
@NonNull final String  title,
@NonNull final String  message,
@Nullable final String  positiveButtonText,
@Nullable final DialogInterface.OnClickListener  positiveListener,
@Nullable final String  negativeButtonText,
@Nullable final DialogInterface.OnClickListener  negativeListener,
@Nullable final DialogInterface.OnCancelListener  cancelListener,
final boolean  isCancelable 
)
static

This method to create the dialog and display it on screen.

Parameters
contextThe context to use. Usually your android.app.Application or android.app.Activity object.
titleThe title displayed in the dialog.
messageThe message to display.
positiveButtonTextThe positiveButtonText displayed in the positive button.
positiveListenerThe positiveListener to be invoked when the positive button of the dialog is pressed.
negativeButtonTextThe negativeButtonText displayed in the negative button.
negativeListenerThe negativeListener to be invoked when the negative button of the dialog is pressed.
cancelListenerThe cancelListener that will be called if the dialog is canceled.
isCancelableSets whether the dialog is cancelable or not.

Example Usage:

Gamebase.Util.showAlertDialog(activity,
"title",
"message",
"OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Clicked OK.
}
}, "Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Clicked Cancel.
}
}, new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
// Canceled...
}
}, true);