Jak utworzyć Usuń Alert w Android Studio Kotlin
myView.deleteBtn.setOnClickListener {
val builder = AlertDialog.Builder(this@MainActivity)
builder.setMessage("Are you sure you want to Delete?")
.setCancelable(false)
.setPositiveButton("Yes") { dialog, id ->
// Delete selected note from database
var dbManager = DbManager(this.context!!)
val selectionArgs = arrayOf(myNote.nodeID.toString())
dbManager.delete("ID=?", selectionArgs)
LoadQuery("%")
}
.setNegativeButton("No") { dialog, id ->
// Dismiss the dialog
dialog.dismiss()
}
val alert = builder.create()
alert.show()
}
android developer