title: Auto complete Textview shows older data secound time when use web service to get data using filterable
body: <p>I integrate AutoCompleteTextView in my project, data for that is come from web service but the thing happens, when i input character first time it shows proper result but at second time it shows older data which comes first time instead of new data.
  My code is according to below. </p>
  
  <pre><code>private AutocompleteTextview act_search;
  List&lt;SearchedItem&gt; resultList = new ArrayList&lt;&gt;();
  private SearchItemAdapter searchAdapter;
  </code></pre>
  
  <p>Initialize in Oncreate Method</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_manager);
  
      searchAdapter = new SearchItemAdapter(this, R.layout.row_search_item);
      act_search.setAdapter(searchAdapter);
      act_search.setDropDownBackgroundResource(R.drawable.auto_bg);
  
      act_search.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
              // TODO Auto-generated method stub
  
              Log.d(TAG, "-- on item click position " + position);
  
          }
      });
  
  }
  </code></pre>
  
  <p>Adapter Class</p>
  
  <pre><code> public class SearchItemAdapter extends ArrayAdapter&lt;String&gt; implements Filterable {
      private List&lt;SearchedItem&gt; mData;
      private boolean error = false;
  
      public SearchItemAdapter(Context context, int textViewResourceId) {
          super(context, textViewResourceId);
          mData = new ArrayList&lt;SearchedItem&gt;();
      }
  
      @Override
      public int getCount() {
          return mData.size();
      }
  
      @Override
      public String getItem(int index) {
          return mData.get(index).name;
      }
  
  
      @Override
      public Filter getFilter() {
          // TODO Auto-generated method stub
  
          Filter filter = new Filter() {
              @Override
              protected FilterResults performFiltering(CharSequence constraint) {
                  FilterResults filterResults = new FilterResults();
  
                  if (constraint != null) {
                      // Retrieve the autocomplete results.
  
                      mData = autocomplete(constraint.toString().trim());
  
                      // Assign the data to the FilterResults
                      filterResults.values = mData;
                      filterResults.count = mData.size();
  
                      Log.d("", "----- inside filter ---- ");
                  }
                  return filterResults;
              }
  
              @Override
              protected void publishResults(CharSequence constraint, FilterResults results) {
  
                  Log.d("Map adapter ", " -- result count " + results.count);
  
                  if (error) {
                      // showToast(getString(R.string.errServerNotResponding));
                  } else {
                      if (results != null &amp;&amp; results.count &gt; 0) {
                          Log.d("Map adapter ", " -- result count " + results.count);
                          notifyDataSetChanged();
                      } else {
                          notifyDataSetInvalidated();
                      }
                  }
  
                  error = false;
              }
          };
  
          return filter;
      }
  
      private List&lt;SearchedItem&gt; autocomplete(String input) {
  
          try {
              String userId = PrefSingleton.getInstance().getUserId();
              RestClient.getApiClient().searchItem(ConstantsCode.API_KEY, userId, input, new Callback&lt;ResponceSearch&gt;() {
                  @Override
                  public void success(ResponceSearch responceSearch, Response response) {
  
                      int status = responceSearch.status;
                      Log.d(TAG, "status -- " + status);
  
                      if (status == ConstantsCode.STATUS_OK) {
                         resultList =  responceSearch.data
  
                      } else {
                          String errMessage = responceSearch.message;
                          showToast(errMessage);
                      }
                  }
  
                  @Override
                  public void failure(RetrofitError error) {
                  }
              });
  
          } catch (Exception e) {
              Log.e("Map adapter ", "Cannot process JSON results", e);
              error = true;
  
          }
  
          return resultList;
  
      }
  
  }
  </code></pre>
  
  <p>Any help are appreciable, can any one have idea for this? Please help.</p>