Kotlin / Anko prevent button from closing Alert Dialog

Viewed 1456

When using positiveButton and negativeButton in Anko's alert builder, it seems both of them result in closing the dialog, even if dismiss() is not called. Is there any way to keep the dialog open after clicking a button (if there are types other than positiveButton/negativeButton, that's fine too)?

alert {
    title = "Add Board"
    customView {
        ....
    }
    positiveButton("OK") { doSomeFunction() }
    negativeButton("Close"){}
}.show()
2 Answers
alert {
  title = "Add Board"
  customView {
    ....
  }
  positiveButton("OK") { /*Keep blank, we'll override it later*/}
  negativeButton("Close"){}

  isCancelable = false // Disable close here
}.show()
Related