I had a strange error occuring with TextWatcher firing multiple times with different inputs on a single change of text, mainly on entering or removing spaces.
After some investigation I got following results on "afterTextChanged":
Test 1, enter space in String "Suger" -> "Su gar":
- "gar"
- " "
- "Su"
- "Su gar"
Test 2, enter another space in String "Su gar" -> "Su ga r":
- "Su r"
- "Su "
- "Su ga "
- "Su ga r"
I've already found a related question suggesting to shut down text suggestions (which I want to keep) or just take the first call (which is plain wrong in my tests): TextWatcher events are being fired multiple times
Theoretically I could just take every event and update everytime because the last one is correct, but I really don't want 3-4 updates in my viewmodel, when one should do the trick.
Has anyone encountered this problem too and has a viable solution?
If needed I can add some code, but I'm really just using the default implementation of a Textwatcher set to an EditText.