title: Filtering a Custom Adapter on listview is not working properly in android?
body: <p>I have a array adapter as follows. and I have implemented a Filterable, but then also when I type in EditText nothing happens.</p>
  
  <pre><code>public class CustomAdapter extends ArrayAdapter&lt;Custom&gt; implements Filterable{
      private ArrayList&lt;Custom&gt; entries;
      private Activity activity;
      private Context context;
      private qrusers qrusers;
      CustomFilter customFilter;
      private String[] udis;
      ArrayList&lt;String&gt; userid= new ArrayList&lt;String&gt;();
      boolean[] checkBoxState;
      LayoutInflater vi;
      public CustomAdapter(Context context, ArrayList&lt;Custom&gt; entries,String []udis) {
          super(context,0,entries);
          this.entries = entries;
          this.context= context;
          this.udis=udis;
          checkBoxState=new boolean[entries.size()];
          this.qrusers =(qrusers) context;
          vi = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      }
  
      public static class ViewHolder{
          public TextView item1;
          public TextView item2;
          public CheckBox chek;
      }
  
      @Override
      public View getView(final int position, View convertView, ViewGroup parent) {
          View v = convertView;
          ViewHolder holder;
          if (v == null) {
  
              v = vi.inflate(R.layout.checkboxlist, null);
              holder = new ViewHolder();
              holder.item1 = (TextView) v.findViewById(R.id.contactname);
              holder.item2 = (TextView) v.findViewById(R.id.companyname);
              holder.chek=(CheckBox)v.findViewById(R.id.checboxlist);
  
  
  
              v.setTag(holder);
  
  
          }
  
          else{
              holder=(ViewHolder)v.getTag();
  
  
          }
          holder.chek.setChecked(checkBoxState[position]);
          holder.chek.setTag(udis[position]);
          holder.chek.setOnClickListener(new OnClickListener() {
              private String s;
              @Override
              public void onClick(View v) {
                  if (((CheckBox) v).isChecked()){
                      checkBoxState[position]=true;
                      //  isChecked=true;
                      s=(String)v.getTag();
                      Log.e("IDDDDDDDD", s);
  
                      userid.add(s);
              Log.e("ADDED ID", userid.toString());
              }
                  else{
                      checkBoxState[position]=false;
                      s=(String)v.getTag();
                      userid.remove(s);
                      Log.e("Removed ID", userid.toString());
                  }
                  }
  
          }
          );
          final Custom custom = entries.get(position);
          if (custom != null) {
              holder.item1.setText(custom.getcustomBig());
              holder.item2.setText(custom.getcustomSmall());
  
          } 
          return v;
          }
      public Filter getFilter() {
          if (customFilter == null) {
              customFilter = new CustomFilter();
          }
          return customFilter;
      }
  
  
      public ArrayList&lt;String&gt; getUserid() {
          return userid;
      }
      public void setUserid(ArrayList&lt;String&gt; userid) {
          this.userid = userid;
      }
      private class CustomFilter extends Filter{
  
          @Override
          protected FilterResults performFiltering(CharSequence constraint) {
              FilterResults results = new FilterResults();
              if(constraint == null || constraint.length() == 0) {
                  results.values=entries;
                   results.count = entries.size();
  
              }
              else{
  
                  ArrayList&lt;Custom&gt; newValues = new ArrayList&lt;Custom&gt;();
                  for (Custom i : entries){
  
                       if (i.toString().toUpperCase().startsWith(constraint.toString().toUpperCase()))
                              newValues.add(i);
                   }
              }
              // TODO Auto-generated method stub
              return results;
          }
  
          @Override
          protected void publishResults(CharSequence constraint,
                  FilterResults results) {
   if (results.count == 0){
  
                   notifyDataSetInvalidated();
               }
               else{
  
                   @SuppressWarnings("unchecked")
                  ArrayList&lt;Custom&gt; lst = (ArrayList&lt;Custom&gt;)results.values;
                   ArrayList&lt;Custom&gt; itemsList = new ArrayList&lt;Custom&gt;(lst);
                   //this.items=mItems;
                  entries =itemsList;              
                  notifyDataSetChanged();
               }
  
          }
  
  
      }
  }
  </code></pre>
  
  <p>and in my activity I am using this piece of code.</p>
  
  <p>usersearch1.addTextChangedListener(new TextWatcher() {</p>
  
  <pre><code>                @Override
                  public void onTextChanged(CharSequence s, int start, int before, int count) {
  
  
                      s=usersearch1.getText().toString();
                      adapter.getFilter().filter(s);
                      Log.e("ALPHABETS", usersearch1.getText().toString());
                      //sendadapter.getFilter().filter(s);
                  }
  </code></pre>