Skip to content

MaterialAlertDialogSignIn

Leonardo D. Palma edited this page Aug 26, 2025 · 10 revisions

Create and display a dialog box with the basic elements of a login page in the dialog container.

Usage

MaterialAlertDialogSignIn

In code:

MaterialAlertDialogSignIn.Builder(applicationContext)
            .setIcon(R.drawable.ic_resource)
            .setTitle("Lorem Ipsum")
            .setCancelable(false)
            .setPositiveButton(object : DialogAlertInterface.OnClickSignInListener {
                override fun onClick(dialog: DialogAlertInterface, username: String, password: String) {
                    TODO("Not yet implemented")
                }
            })
            .setNegativeButton(ButtonIconAlert(R.drawable.ic_resource), object : DialogAlertInterface.OnClickListener {
                override fun onClick(dialog: DialogAlertInterface, whichButton: DialogAlertInterface.UI) {
                    TODO("Not yet implemented")
                }
            })
            .create()
            .show()

Attributes

MaterialAlertDialogSignIn offers several attributes for a deeper view configuration, the following table shows all these options and their default value.

Name Description Values Default Related method(s)
Builder Creates a builder for an alert dialog that uses the default alert dialog theme Context N/A Builder()
Icon Set the drawable resource to be used in the icon Int R.mipmap.ic_launcher_round setIcon()
Icon Tint Color Set background tint for icon Int or rgb(R,G,B) N/A setIconTintColor()
Icon Tint Color Set background tint for icon IntRes N/A setIconTintColorRes()
Title Set the title displayed String, Int N/A setTitle()
Message Sets the message to display String, Int N/A setMessage()
Cancelable Sets whether the dialog is cancelable or not Boolean false setCancelable()
Show Icon Sets whether the dialog icon should be displayed Boolean true setShowIcon()
Box Corner Set the corner radius of the TextInputLayout float N/A setBoxCornerRadius()
Gravity Set gravity of the dialog Int [android.view.Gravity] N/A setGravity()
Count Down Timer Set a countdown on one of the buttons (DialogAlertInterface.UI, Long) N/A setCountDownTimer()
PositiveButton Set a listener to be invoked when the positive button of the dialog is pressed null, String or Int N/A setPositiveButton()
NegativeButton Set a listener to be invoked when the negative button of the dialog is pressed null, String or Int N/A setNegativeButton()
create Creates an MaterialAlertDialogSignIn with the arguments supplied to this builder - - create()
show Start the dialog and display it on screen - - show()

If you want to add more functionality to dialog events, you can use the following methods to capture the actions.

  • When the dismiss option is called from the dialog box, you can use the setOnDismissListener method to perform additional actions.
  • When the cancel option is called from the dialog box, you can use the setOnCancelListener method to perform additional actions.
  • When the show option is called from the dialog box, you can use the setOnShowListener method to perform additional actions.

Clone this wiki locally