show

open fun show(@NonNull context: Context, @NonNull title: String, @NonNull message: String)
open fun show(@NonNull context: Context, @NonNull title: String, @NonNull message: String, isCancelable: Boolean)
open fun show(@NonNull context: Context, @NonNull title: String, @NonNull message: String, @Nullable clickListener: DialogInterface.OnClickListener, isCancelable: Boolean)
open fun show(@NonNull context: Context, @NonNull title: String, @NonNull message: String, @Nullable positiveButtonText: String, @Nullable positiveListener: DialogInterface.OnClickListener, isCancelable: Boolean)
open fun show(@NonNull context: Context, @NonNull title: String, @NonNull message: String, @Nullable positiveButtonText: String, @Nullable positiveListener: DialogInterface.OnClickListener, @Nullable negativeButtonText: String, @Nullable negativeListener: DialogInterface.OnClickListener, isCancelable: Boolean)


open fun show(@NonNull context: Context, @NonNull title: String, @NonNull message: String, @Nullable positiveButtonText: String, @Nullable positiveListener: DialogInterface.OnClickListener, @Nullable negativeButtonText: String, @Nullable negativeListener: DialogInterface.OnClickListener, @Nullable cancelListener: DialogInterface.OnCancelListener, isCancelable: Boolean)

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

Parameters

context

The context to use. Usually your android.app.Application or android.app.Activity object.

title

The title displayed in the dialog.

message

The message to display.

positiveButtonText

The positiveButtonText displayed in the positive button.

positiveListener

The positiveListener to be invoked when the positive button of the dialog is pressed.

negativeButtonText

The negativeButtonText displayed in the negative button.

negativeListener

The negativeListener to be invoked when the negative button of the dialog is pressed.

cancelListener

The cancelListener that will be called if the dialog is canceled.

isCancelable

Sets whether the dialog is cancelable or not.

Example Usage:

SimpleAlertDialog.show(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);

open fun show(@NonNull context: Context, themeResId: Int, @NonNull title: String, @NonNull message: String, @Nullable positiveButtonText: String, @Nullable positiveListener: DialogInterface.OnClickListener, @Nullable negativeButtonText: String, @Nullable negativeListener: DialogInterface.OnClickListener, @Nullable cancelListener: DialogInterface.OnCancelListener, isCancelable: Boolean)

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

Parameters

context

The context to use. Usually your android.app.Application or android.app.Activity object.

themeResId

the resource ID of the theme against which to inflate this dialog, or 0 to use the parent context's default alert dialog theme

title

The title displayed in the dialog.

message

The message to display.

positiveButtonText

The positiveButtonText displayed in the positive button.

positiveListener

The positiveListener to be invoked when the positive button of the dialog is pressed.

negativeButtonText

The negativeButtonText displayed in the negative button.

negativeListener

The negativeListener to be invoked when the negative button of the dialog is pressed.

cancelListener

The cancelListener that will be called if the dialog is canceled.

isCancelable

Sets whether the dialog is cancelable or not.