title: Problem with AutoCompleteTextView and Spinner using the same Adapter
body: <p>I have a list of "categories" that are stored as Strings in an ArrayAdapter in my app. This much is pretty simple. The adapter is a field of the Activity and accessible everywhere. It is populated with values during onCreate().</p>
  
  <p>I have a "Entry" Dialog that contains an AutoCompleteTextView which uses this adapter and works very well. This is basically a dialog to add new items to a list.</p>
  
  <p>I also have a second Dialog which acts as a filter for my list and has a single Spinner which when the Dialog is created, uses the same ArrayAdapter. Here's the problem.</p>
  
  <p>If I use the filter Dialog before the entry Dialog, the Spinner is populated with all of the items from the adapter. Works well.</p>
  
  <p>Any and every time I use the entry Dialog, the AutoCompleteTextView works properly.</p>
  
  <p>The problem comes if I use the entry Dialog and select an item in the AutoCompleteTextView when it suggests something. After selecting a suggested item in the popup, even if I cancel the entry Dialog, the next time I bring up the filter Dialog, the Spinner initially shows the item that was last selected from the AutoCompleteTextView (instead of the first item in the adapter), and only displays that single item in the Spinner's list if clicked/touched. The only way to fix it is to end the application and re-open it. I'm not getting any errors or anything in logcat that is helpful.</p>
  
  <p>EDIT - Okay, I've removed the previous code to replace it with a simple test case that I produced. The bottom line is that I would like to know if this is a bug, or if if it is expected results. When a suggestion is selected in an AutoCompleteTextView, I can confirm that the ArrayAdapter that is linked to it has filtering applied so that it's count is affected and the only items shown if the adapter is accessed in a Spinner will be those that were filtered down to. I also added button to display a toast to show that the count is affected. Type "te" in the autocomplete, select either Test entry. They try the spinner or click the button to see the adapter's count is only 2.</p>
  
  <p>So the final question is now... can the adapter's filter be reset (other than by typing in and clearing the AutoCompleteTextView)? I can't find any method to do this. I have worked around the problem in my actual app by setting up a temporary adapter, copying over the main adapters items and setting the views to use the temporary adapter instead. My phone is running 2.2, and I have tested as high as 2.3.3 API level 10 in an emulator.</p>
  
  <p>The xml for main.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" &gt;
  &lt;AutoCompleteTextView android:id="@+id/actv"
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content"
      android:layout_alignParentTop="true"
      android:layout_centerHorizontal="true" /&gt;
  &lt;Spinner android:id="@+id/spinner"
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content"
      android:layout_centerInParent="true" /&gt;
  &lt;Button android:id="@+id/button"
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content"
      android:text="Check It"
      android:layout_alignParentBottom="true"
      android:layout_centerInParent="true" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>The code for MainActivity.java</p>
  
  <pre><code>public class MainActivity extends Activity {
      /** Called when the activity is first created. */
  
      AutoCompleteTextView actv;
      Spinner spinner;
      Button button;
  
      String [] adapterList = {"Test1", "Test2", "Garbage1", "Garbage2"};
  
      ArrayAdapter&lt;String&gt; adapter;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_dropdown_item_1line, adapterList);
  
          actv = (AutoCompleteTextView) findViewById(R.id.actv);
          spinner = (Spinner) findViewById(R.id.spinner);
          button = (Button) findViewById(R.id.button);
  
          actv.setAdapter(adapter);
          spinner.setAdapter(adapter);
  
          button.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  Toast.makeText(MainActivity.this, "" + adapter.getCount() + " Items in Adapter", Toast.LENGTH_SHORT).show();
              }
          });
      }
  }
  </code></pre>