Custom filtering in AutoCompleteTextView not working
<p>I am extending the Array Adapter as it follows but I get still the old results can you please tell me what is the problem ?</p>

<pre><code>public class Adaptor extends ArrayAdapter&lt;String&gt; implements Filterable{

        private ArrayList&lt;String&gt; items;

        public Adaptor(Context context, int textViewResourceId, String[] objects) {
            super(context, textViewResourceId, objects);
            items = new ArrayList&lt;String&gt;();
            for (int i = 0; i &lt; objects.length ; i++)
                items.add(objects[i]);

        }


        @Override
        public int getCount() {
            return items.size();
        }


        @Override
        public String getItem(int position) {
            return items.get(position);
        }

        @Override
        public Filter getFilter() {
            Filter myFilter = new Filter(){

                @Override
                protected FilterResults performFiltering(CharSequence arg0) {
                    FilterResults rezultate = new FilterResults();
                    ArrayList&lt;String&gt; chestii = new ArrayList&lt;String&gt;();
                    for (int i = 0; i &lt; items.size() ; i++)
                    {
                        String tmp = items.get(i).toUpperCase();
                        if (tmp.startsWith(arg0.toString().toUpperCase()))
                                chestii.add(items.get(i));

                    }
                    rezultate.count = chestii.size();
                    rezultate.values = chestii;
                    return rezultate;
                }

                @Override
                protected void publishResults(CharSequence constraint,
                        FilterResults results) {
                    if (results != null &amp;&amp; results.count &gt; 0)
                    {
                        notifyDataSetChanged();
                    }
                    else notifyDataSetInvalidated();

                }

            };
            return myFilter;
        }




    }
</code></pre>
