+ 1
enable and disable button in kotlin
I have a function in which there is a condition that if startdate and enddate are filled with dates, then the "Show" button will be enabled. But first the "Show" button must be disabled. I have tried with this code but it still fails. What do I have to do? private fun validateButton() { binding.btnShow.isEnabled = false if(binding.startDate.isNotEmpty() && binding.endDate.isNotEmpty()) { binding.btnShow.isEnabled = true } }
1 Respuesta
0
Try to declare this button false when screen is loading