I used the maxLength
method. I want you to be notified "Limit characters here are 10 characters"
I know the user can't add characters anyway, but I still want to be notified.
How do i get when the user is still trying to add characters to throw him an error?
Asked
Active
Viewed 237 times
1

Ziv Sion
- 165
- 1
- 11
-
Could you add the code in question? – Ethan Moore Oct 26 '20 at 18:11
-
there is nothing to see. i just asked how to know when the user tring to add letters – Ziv Sion Oct 26 '20 at 18:12
1 Answers
0
I suppose you are talking about an EditText view.
Which one do you use? The Android widget one or the Material one?
Because the Material TextField (https://material.io/develop/android/components/text-fields) has an easy to use character counter:
If you then want to additionally show an error (e.g. with a Toast) you can get the max length counter by calling yourTextInputLayout.getCounterMaxLenght
and check it.

Cyb3rKo
- 413
- 7
- 22