androidkotlinandroid-edittextandroid-buttonandroid-textwatcher

How to disable a button until editText entries are filled?


Following is my code for disabling and enabling the button depending upon editText entries. There are no errors here but, my app is keep on crashing. Can anyone please help me here..!

editTextNumberDecimal2.addTextChangedListener (object : TextWatcher1 {

    override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
        TODO("Not yet implemented")

        button2.isEnabled = false
    }

    override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
         TODO("Not yet implemented")

         button2.isEnabled = s.toString().trim().isNotEmpty()
    }

    override fun afterTextChanged(s: Editable?) {
        TODO("Not yet implemented")

    }
})

Solution

  • Simply remove these lines:

    TODO("Not yet implemented")