Skip to content

SimpleCheckDialog

Eltos edited this page Oct 29, 2021 · 20 revisions

CheckBox dialog

extends CustomViewDialog

API reference Examples

A dialog with a single checkbox.

If multiple check boxes are required consider using a SimpleListDialog or a SimpleFormDialog instead.

Usage

For general usage see SimpleDialog.

Additional methods are provided to adjust the checkbox label (label), it's initial state (check), whether the check is required to press the positive button (checkRequired) etc. Please refer to the API reference for a comprehensive documentation of these methods.

Receiving results

For general usage see SimpleDialog.

The extras Bundle returned will contain the following additional keys:

boolean checked = extras.getBoolean(SimpleCheckDialog.CHECKED);    // If the checkbox was checked

Examples

SimpleCheckDialog.build()
                 .title("Accept?")
                 .msg("Please accept to continue.")
                 .label("Accept")
                 .check(true)
                 .checkRequired(true)
                 .show(this, DIALOG_TAG);
SimpleCheckDialog.build()
                 .title(R.string.terms_title)
                 .msgHtml(R.string.terms_and_conditions_html_styled)
                 .label(R.string.terms_accept)
                 .checkRequired(true)
                 .pos(R.string.accept)
                 .neg(R.string.decline)
                 .cancelable(false)
                 .show(this, DIALOG_TAG);