Wyszukiwanie przykładu Androida RecyClerview

public Filter getFilter() {
return new Filter() {
    @Override
    protected FilterResults performFiltering(CharSequence constraint) {
        final FilterResults oReturn = new FilterResults();
        final List<YourClass> results = new ArrayList<YourClass>();
      // origin is an arraylist of your data 
        if (orig == null)
            orig  = items;// items is an array list variable
            if (constraint != null){
                if(orig !=null & orig.size()>0 ){
                    for ( final YourClass g :orig) {
                        //getCaredName is the string that you 
                      // will saerch for in searchview 
                        if (g.getCardName().toLowerCase()
                            .contains(constraint.toString()))
                          results.add(g);
                    }
                }
                oReturn.values = results;
            }
            return oReturn;
        }

@Override
    protected void publishResults(CharSequence constraint, FilterResults results) {
        items = (ArrayList<BaseOfCards>)results.values;
        notifyDataSetChanged();

    }
};
  
  ////// this one in the main activity where you listen to search view query
  @Override
public boolean onQueryTextChange(String newText) {
    if ( TextUtils.isEmpty ( newText ) ) {
        adapter.getFilter().filter("");
    } else {
        adapter.getFilter().filter(newText.toString());
    }
    return true;
}
Mohamed Boumlyk