How to prevent a dialog (alert) from closing when you touch outside or press back using Anko

Viewed 1757

I'm ussing kotlin and anko for creating an alert/dialog (code below), but when you tap outside or press back it closes.

Here is the code

alert("TITLE") {
    title("Text")
    positiveButton("Ok") { action() }
}.show()

Here is how the solution will be in java (without ussing anko too)

dialog.setCancelable(false); // for prevent on back pressed
dialog.setCanceledOnTouchOutside(false); // for prevent on touching outside

Any ideas on how to achieve this using kotlin and anko? Thanks :)

1 Answers
Related