In a AutoCompleteTextView I want to show the auto complete list after there is a pause of 1 sec by user in typing. I tried using handler
handler.postDelayed( new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
if ( text.length() >= 3 ) {
// do something
} else if ( text.length() == 0 ) {
// do something
}
}
}, 1000 );
This code is a part of onTextChanged. So what it is happening is whenever there is a text change at that moment postDelayed is called and inside code will be called after a second. So how can I prevent that so the inner code is only called when there is a puase of 1 sec by user in typing.
e.g: If I type Ind (pause of 1 sec) then inner code execute should happen. But I type India then inner code should not execute for Ind, Indi, India. Need your suggestions.