title: SimpleAdapter custom filter
body: <p>I'm trying to get a custom filter on a SimpleAdapter working and seem to be falling at the last hurdle. When debugging the code I can see the resulting filtered ArrayList in itemsFiltered in the publishResults method, but the complete list is always shown.</p>
  
  <p>How do I get the adapter to work of the filtered results list not the complete unfiltered list?</p>
  
  <p>Code is :</p>
  
  <pre><code>private class TextCharFilter extends Filter{
  
      @Override
      protected FilterResults performFiltering(CharSequence constraint) {
  
          // convert search string to lower case - the filtering is not case sensitive
          constraint = constraint.toString().toLowerCase();
  
          // define the result object
          FilterResults result = new FilterResults();
          // define a place to hole the items that pass filtering         
          List&lt;HashMap&lt;String, String&gt;&gt; filteredItems = new ArrayList&lt;HashMap&lt;String,String&gt;&gt;();
  
          // loop through the original list and any items that pass filtering are added to the "filtered" list
          if(constraint != null &amp;&amp; constraint.toString().length() &gt; 0) {
  
              for(int i = 0; i &lt; items.size(); i++) {
                  HashMap&lt;String, String&gt; tmp = items.get(i);
                  String candidate = tmp.get("PT").toLowerCase();
  
                  if(candidate.contains(constraint) ) {
                      filteredItems.add(tmp);
                  }
              }
  
              // set the result to the "filtered" list.
              result.count = filteredItems.size();
              result.values = filteredItems;
  
          }    
          else
          {
              // if nothing to filter on -  then the result is the complete input set
              synchronized(this)
              {
               result.values = items;
               result.count = items.size();
              }
          }
          return result;
      }
  
      @SuppressWarnings("unchecked")
      @Override
      protected void publishResults(CharSequence constraint, FilterResults results) {
  
          ArrayList&lt;HashMap&lt;String, String&gt;&gt; tmp = (ArrayList&lt;HashMap&lt;String, String&gt;&gt;)results.values;
  
          itemsFiltered = new ArrayList&lt;HashMap&lt;String,String&gt;&gt;();
  
          for (int i = 0; i &lt; tmp.size(); i++){
              itemsFiltered.add(tmp.get(i));
          }
  
          notifyDataSetChanged();
  
          notifyDataSetInvalidated();
      }
  
  }
  </code></pre>