In your base adapter, save two copies of the list, one original and one filtered. And change all the links in your BaseAdapter , to use only the filtered list.
1), activate the filter on the ListView : lv.setTextFilterEnabled (true);
2) in your TextWatcher, enable the filter in your srchadptr.getFilter () list. filter (s)
3) Update the base adapter to save two copies of the data, and replace the links to the filter list instead of the original list.
public class SearchAdapter extends BaseAdapter implements Filterable { List<String> list = new ArrayList<String>(); List<String> listFiltered = new ArrayList<String>(); public SearchAdapter(Context context, ArrayList<String> list) { this.context = context; this.inflater = LayoutInflater.from(context) this.list = list; this.listFiltered=list; } public int getCount() { return listFiltered.size();
source share