'Enabling the disabled button when clicked on a checkbox in android kotlin

I'm new to android and working on checkbox. Initially, button is disabled but when a user click on a checkbox it will enable the button. But in my case it is not happening.

checkBoxBtn.isEnabled = false
    val isCheckBoxChecked: Boolean = checkBoxChecked()
    if(isCheckBoxChecked) {
        checkBoxBtn.isEnabled = true
    }
    checkBoxBtn.setOnClickListener(View.OnClickListener {
        var msg: String = onCheckboxClicked()
        Toast.makeText(this, "You selected $msg.", Toast.LENGTH_SHORT).show()
    })

private fun checkBoxChecked(): Boolean {
    if(checkBox1.isChecked or checkBox2.isChecked or checkBox3.isChecked or checkBox4.isChecked or checkBox5.isChecked) {
        return true
    }
    return false
}


Solution 1:[1]

Assuming all other checkboxes are initially unchecked ,the compiler is going to return false for the function "checkBoxChecked". So, you can move "checkBoxBtn.isEnabled=true" to onChecked method of the other five checkboxes.This way once you click on any of the five checkboxes the button is enabled.

if my assumption is wrong please provide the context.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1