You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The MDC-101 Codelab is using the setOnKeyListener method to detect the characters typed into the password text field. That method does not work with a soft input keyboard (what one mostly used on an Android device) but only with a hardware keyboard.
The right solution is to use a TextWatcher like that:
// Clear the error once more than 8 characters are typed.
val watcher = object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
}
override fun afterTextChanged(s: Editable?) {
if (isPasswordValid(password_edit_text.text)) {
// Clear the error.
password_text_input.error = null
}
}
}
view.password_edit_text.addTextChangedListener(watcher)
The text was updated successfully, but these errors were encountered:
The MDC-101 Codelab is using the
setOnKeyListener
method to detect the characters typed into the password text field. That method does not work with a soft input keyboard (what one mostly used on an Android device) but only with a hardware keyboard.The right solution is to use a
TextWatcher
like that:The text was updated successfully, but these errors were encountered: