Exemplo n.º 1
0
 @Override
 public void setAdapter(Adapter adapter) {
   if (adapter != null) {
     mAutoLoadAdapter = new AutoLoadAdapter(adapter);
   }
   super.swapAdapter(mAutoLoadAdapter, true);
 }
Exemplo n.º 2
0
  @Override
  public boolean onQueryTextChange(String newText) {
    searchItems = new ArrayList<>();

    if (newText.length() > 0) {
      for (int i = 0; i < items.size(); i++) {
        Person person = items.get(i);
        if (person.name.toLowerCase().contains(newText)) {
          Log.i("tag", person.name + "\n");
          searchItems.add(person);
        }
      }
      MyAdapter searchAdapter = new MyAdapter(searchItems);
      directoryList.swapAdapter(searchAdapter, true);

    } else {
      searchItems.clear();
      directoryList.swapAdapter(adapter, true);
    }
    return true;
  }