title: android :filter is not working in costum gridview adapter
body: <p>i'm trying to make a simple app wish where i've got a gridview and a edittext and when i type in the edittext it filters the gridview enter code here</p>
  
  <pre><code>class CostumAdapter  extends ArrayAdapter&lt;Personne&gt; implements Filterable{
      Costumfilter filter;
      ArrayList &lt;Personne&gt; filterlist;
      ArrayList &lt;Personne&gt; items;
      public CostumAdapter(Context context, ArrayList &lt;Personne&gt; items) {
          super(context,R.layout.costum_row,items);
          this.filterlist=items;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          LayoutInflater inflater = LayoutInflater.from(getContext());
          View costumview = inflater.inflate(R.layout.costum_row, parent, false);
          Personne imed=getItem(position);
          TextView mytext = (TextView) costumview.findViewById(R.id.mytext1);
          mytext.setText(imed.firstname);
          mytext.setBackgroundColor(getRandomColor());
          return  costumview;
      }
  
      @Override
      public Filter getFilter() {
          if(filter == null){
              filter=new Costumfilter();
          }
          return filter;
      }
  
      public int getRandomColor(){
          Random rnd = new Random();
          return Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
      }
  
      class Costumfilter extends Filter{
  
          @Override
          protected FilterResults performFiltering(CharSequence constraint) {
              FilterResults results = new FilterResults();
              if(constraint != null &amp;&amp; constraint.length()!=0){
                  constraint = constraint.toString().toLowerCase();
                  ArrayList&lt;Personne&gt; filters =new ArrayList&lt;Personne&gt;();
                  for (int i=0; i &lt;filterlist.size();i++){
                      //probleme peut etre ici
                      if (filterlist.get(i).firstname.toLowerCase().contains(constraint.toString().toLowerCase())){
                          Personne p =new Personne(filterlist.get(i).firstname,filterlist.get(i).lastname,filterlist.get(i).number,filterlist.get(i).mail);
                          filters.add(p);
                      }
                      if (filterlist.get(i).firstname.toLowerCase().startsWith(constraint.toString().toLowerCase())){
                          Personne p =new Personne(filterlist.get(i).firstname,filterlist.get(i).lastname,filterlist.get(i).number,filterlist.get(i).mail);
                          filters.add(p);
                      }
                  }
                  results.count=filters.size();
                  results.values=filters;
              }else{
                  results.count=filterlist.size();
                  results.values=filterlist;
              }
              return results;
          }
  
          @Override
          protected void publishResults(CharSequence constraint, FilterResults results) {
              items=(ArrayList&lt;Personne&gt;) results.values;
              notifyDataSetChanged();
          }
      }
   }
  </code></pre>
  
  <p>this is my main class</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  ArrayList&lt;Personne&gt; items = new ArrayList&lt;Personne&gt;();
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      ActionBar actionBar= getSupportActionBar();
      actionBar.hide();
  
      EditText textfilter =(EditText) findViewById(R.id.textfilter);
  
      items.add(new Personne("kabouya","imed","0553164597","haha95@live.fr"));
      items.add(new Personne("Tazir","oussama","0654613257","oussamaMail@live.fr"));
      items.add(new Personne("kabouya","imed","0553164597","haha95@live.fr"));
      items.add(new Personne("Tazir","oussama","0654613257","oussamaMail@live.fr"));
      items.add(new Personne("kabouya","imed","0553164597","haha95@live.fr"));
      items.add(new Personne("Tazir","oussama","0654613257","oussamaMail@live.fr"));
      items.add(new Personne("kabouya","imed","0553164597","haha95@live.fr"));
      items.add(new Personne("Tazir","oussama","0654613257","oussamaMail@live.fr"));
  
      final CostumAdapter adapter = new CostumAdapter(MainActivity.this, items);
  
      GridView mygrid=(GridView)findViewById(R.id.mygrid);
      mygrid.setAdapter(adapter);
      mygrid.setTextFilterEnabled(true);
      textfilter.addTextChangedListener(new TextWatcher() {
          @Override
          public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
  
          }
  
          @Override
          public void onTextChanged(CharSequence ss, int i, int i1, int i2) {
              adapter.getFilter().filter(ss.toString());
          }
  
          @Override
          public void afterTextChanged(Editable editable) {
  
          }
      });
  
      mygrid.setOnItemClickListener(
              new AdapterView.OnItemClickListener(){
  
                  @Override
                  public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) {
                      String  someone=String.valueOf(adapterView.getItemAtPosition(i).toString());
                      AlertDialog.Builder mBuilder = new AlertDialog.Builder(MainActivity.this);
                      View mView = getLayoutInflater().inflate(R.layout.custom_dialog, null);
                      TextView textnum =(TextView) mView.findViewById(R.id.textnum);
                      TextView textmail =(TextView) mView.findViewById(R.id.textmail);
                      TextView maintext =(TextView) mView.findViewById(R.id.maintext);
                      maintext.setText(items.get(i).firstname.toString()+" "+items.get(i).lastname.toString());
                      textnum.setText(items.get(i).number.toString());
                      textmail.setText(items.get(i).mail.toString());
                      mBuilder.setView(mView);
                      AlertDialog dialog = mBuilder.create();
                      dialog.show();
                  }
              }
      );
  }
  </code></pre>
  
  <p>this is a school project and it has due date so pls help me :)</p>