TextWatcher events are being fired multiple times

后端 未结 7 2118
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-05 12:57

I have an annoying problem with TextWatcher. i\'ve been searching the web but couldnt find anything. appreciate if someone could assist me.

For some reason t

7条回答
  •  囚心锁ツ
    2020-12-05 13:25

    I had the same kind of problem, when I pressed backspace with cursor at the end of a continuous text, afterTextChange was called 3 times: - The first time with the correct s value - The second time with a clear value - The third time with the correct value again

    After having search a lot on the web, I tried to change my EditText inputType to

    android:inputType="textNoSuggestions"
    

    Don't ask me why, but it worked, afterTextChanged is now called only once.

提交回复
热议问题