Throttle onQueryTextChange in SearchView
2022-09-04 05:02:32
“限制”的最佳方法是什么,以便我的方法每秒仅调用一次,而不是每次用户键入时调用?onQueryTextChange
performSearch()
public boolean onQueryTextChange(final String newText) {
if (newText.length() > 3) {
// throttle to call performSearch once every second
performSearch(nextText);
}
return false;
}