+ 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 } }

22nd Apr 2022, 7:36 AM
gdf14
1 Réponse
0
Try to declare this button false when screen is loading
22nd May 2022, 10:50 AM
Anubhav A
Anubhav A - avatar