I have a bunch of TextInputEditText's in my layout defined like so:
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/confirmPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/registration_confirm_password"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
And when the users tries to submit the form, I have a validate method that checks each field and sets an error on invalid fields, like so:
if(confirmPassword.text.toString() != password.text.toString()) {
confirmPassword.error = "Passwords don't match"
confirmPassword.setOnKeyListener { _, _, _ ->
confirmPassword.error = null
true
}
valid = false
}
The OnKeyListener is there to remove the error as soon as the user starts correcting his mistake.
This code works perfectly in my emulators and on my device with Android 5.1.1. But on the device of one of my users, a Samsung Galaxy S6 Edge with Android 6.0, when he makes a mistake and a field has an error on it, he cannot edit it anymore.
Am I using TextInputEditText wrong? Is it a known bug? Is there a workaround?