I want the editText firstname and the email field editText to be filled in correctly. The validation button which is disabled initially should become enabled (especially for the email address in name@blabla.com format). I tried with textWatcher but I didn't understand how to use it
editText1.addTextChangedListener(object: TextWatcher {
override fun onTextChanged(s:CharSequence, start:Int, before:Int, count:Int) {
if (s.toString().trim({ it <= ' ' }).isEmpty())
{
button.setEnabled(false)
}
else
{
button.setEnabled(true)
}
}
override fun beforeTextChanged(s:CharSequence, start:Int, count:Int,
after:Int) {
// TODO Auto-generated method stub
}
override fun afterTextChanged(s: Editable) {
// TODO Auto-generated method stub
}
})