Using a SearchView
in my application.
Is there anyway in which I can make the call to onQueryTextChange() method delayed. Like, when user type a sequence o
To delay the call to your server, use the following code in your onQueryTextChange method, the variables mQueryString and mHandler must be class variables. also check mHandler!=null
@Override
public boolean onQueryTextChange(String searchTerm) {
mQueryString = searchTerm;
mHandler.removeCallbacksAndMessages(null);
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
//Put your call to the server here (with mQueryString)
}
}, 300);
return true;
}