title: Android AutoCompleteTextView with List<String>
body: <p>I have an <code>AutoCompleteTextView</code> where the user types an address. I want to be able to show suggestions below as he types. To do that I get a list of possible addresses via the Reverse Geocoding API. i want then to show this list of strings (possible addresses) to the user. Just like the google maps app does.</p>
  
  <p>I have added a <code>TextChangedListener</code> to the <code>AutoCompleteTextView</code>. On the <code>onTextChanged()</code> event an <code>AsyncTask</code> is executed where the list of possible address gets updated on the <code>onPostExecute()</code>.</p>
  
  <pre><code>autoText.addTextChangedListener(new TextWatcher() {
      @Override
      public void onTextChanged(CharSequence s, int start, int before, int count) {
          new GeoTask().execute();
      }
  });
  </code></pre>
  
  <p><strong>Attempt 1</strong></p>
  
  <p>This is the list:</p>
  
  <pre><code>static List&lt;String&gt; suggestionList = new ArrayList&lt;String&gt;();
  </code></pre>
  
  <p>And this is the code for the adapter for the <code>AutoCompleteTextView</code> :</p>
  
  <pre><code>autoText.setThreshold(3);
  ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_dropdown_item_1line, suggestionList);
  autoText.setAdapter(adapter);
  adapter.setNotifyOnChange(true);
  </code></pre>
  
  <p>With the above code nothing shows up.</p>
  
  <p><strong>Attempt 2</strong></p>
  
  <p>I also tried using an array as an argument for the adapter and every time the list of address gets updated I convert it to the array.</p>
  
  <pre><code>static String[] suggestions;
  static List&lt;String&gt; suggestionList = new ArrayList&lt;String&gt;();
  </code></pre>
  
  <p>Adapter:</p>
  
  <pre><code>autoText.setThreshold(3);
  ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_dropdown_item_1line, suggestionList);
  autoText.setAdapter(adapter);
  adapter.setNotifyOnChange(true);
  </code></pre>
  
  <p>AsyncTask:</p>
  
  <pre><code>protected void onPostExecute(Void aVoid) {
  ...
  suggestions = suggestionList.toArray(new String[suggestionList.size()]);
  super.onPostExecute(aVoid);
  }
  </code></pre>
  
  <p>How can i make it work? Is there a way to use the adapter with the list?</p>