DEV Community

Abdul Lateef
Abdul Lateef

Posted on

How to dismiss a Material Alert Dialog in Kotlin

I have created this Material Alert Dialog. I want to dismiss it once the record is update or when user click cancel button (btnCancel). I am unable to use dismiss() as it's not available.

private fun updateRecordDialog(id: Int, employeeDao: EmployeeDao){
        val updateDialog = MaterialAlertDialogBuilder(this, R.style.Theme_Dialog)
        val binding = DialogUpdateBinding.inflate(layoutInflater)
        updateDialog.setView(binding.root)

Top comments (0)