Ololoking Ololoking - 1 month ago 9
Android Question

Material dialog library - prevent dismissing/closing the dialog on onPositive function call

I am using this Material Dialog library and when I click the positive button, the

onPositive
function is called and the dialog is closed. How can I prevent the dialog from closing/dismissing?

Thanks for answers.

Answer

add: autoDismiss(false)

  new MaterialDialog.Builder(mainActivity)
            .title(R.string.title)
            .autoDismiss(false)
            .content(R.string.content)
            .positiveText(R.string.positive)
            .negativeText(R.string.negative)
            .positiveColor(setColor())
            .callback(new MaterialDialog.ButtonCallback() {
                @Override
                public void onPositive(MaterialDialog dialog) {

                }
            })
            .negativeColor(setColor())
            .typeface(titleAndActions, contentAndListItems)
            .build()
            .show();