Reputation: 2235
I can set setCancelable(false) for a dialog in Code B, now I hope to set the same property for an Anko dialog in Code A.
How can I do ? Thanks!
Code A
private fun deleteBackup(){
alert(getString(R.string.DialogDeleteContent), getString(R.string.DialogDeleteTitle)) {
yesButton {
//...
}
}.show()
}
Code B
private fun promptBuyWhenExpired() {
if (IsExpired(applicationContext) ) {
val builder = AlertDialog.Builder(this)
builder.setMessage(getString(R.string.ExpiredTitle))
builder.setTitle(getString(R.string.ExpiredWarning))
builder.setCancelable(false)
builder.setPositiveButton(getString(R.string.BtnYes)) { dialog, which ->
finish()
}
builder.create().show()
}
}
Answer:
I get it, it should be .show().setCancelable(false)
Upvotes: 0
Views: 689
Reputation: 4956
alert("message", "title") {
yesButton {
//...
}
isCancelable = false
}.show()
Upvotes: 1