Skip to content

Instantly share code, notes, and snippets.

@matdziu
Created October 21, 2016 13:11
Show Gist options
  • Select an option

  • Save matdziu/12b6efc2deadf4e3f5452182aaa6ba33 to your computer and use it in GitHub Desktop.

Select an option

Save matdziu/12b6efc2deadf4e3f5452182aaa6ba33 to your computer and use it in GitHub Desktop.
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return true;
}
@Override
public boolean onQueryTextChange(String newText) {
if (!newText.isEmpty()) {
RecyclerView.Adapter adapter = new NamesAdapter(namesAPI.searchForName(newText));
recyclerView.swapAdapter(adapter, false);
}
return true;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment