I'm currently making my app accessible and I'm having problem with my EditTexts:
In every EditText, the user's input is being validated at some point (e.g. after pressing a button) and if the input is invalid, I show an error using editText.setError("message")
. The problem is that if TalkBack is on, it will not automatically focus and read the error. Also, since I can't get the error's view, I can't ask TalkBack to focus it via sendAccessibilityEvent
.
I would appreciate any ideas on how to solve this issue while still using editText.setError()
.
Edit 1 Added code for @Abhishek V solution:
public class BaseEditText extends EditText {
...
...
@Override
public void setError(CharSequence error) {
super.setError(error);
announceForAccessibility(error);
}
}