I am implementing addTextChangedListener on an EditText.
tagNameEditText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
last_text_edit = System.currentTimeMillis();
searchStringFilter = s.toString();
h.removeCallbacks(input_finish_checker);
already_queried = false;
h.postDelayed(input_finish_checker, idleTime);
// getFilter().filter(s.toString());
}
@Override
public void afterTextChanged(Editable s) {
}
});
Problem is whenever text changes in EditText it is called multiple times. But i want to call the OnTextChanged() only once after the text changes. Is there any way to achieve this ?. Any help is appreciated :)
Even I faced the similar problem. What i did was, i put a time say 1 second or 2 second. So i called the filter whenever user takes this much time/pause in typing.
refer to -