How to catch the length of an EditText text in an input?

I want to get text from EditText, and then get the length of the text, each time the user types or deletes values .

I did this with the InputFilter filter , but my experience is that the input filter does not listen to the delete key.

So, for example, if the user writes something to my EditText, then he deletes it all, my toast message will not tell me “0”, it will just stay at “5”, for example (printed text length)

Is there a way to return a value for the length of an EditText text every time a user types or deletes it?

+3
source share
1 answer

TextWatcher, TextView.addTextChangedListener(). , , , .

+4

All Articles