AutoCompleteTextView hide and show dropdown on adapter change
<p>I have an AutoCompleteTextView that gets suggestion from an API with an AsyncTask.
in onPostExecute i create a new adapter, set it to the AutoCompleteTextView and notify data set change to the adapter.</p>

<p>in a TextWatcher I execute the AsyncTask.</p>

<p>everything is working fine except that the dropdown is dismissed and shown every time the adapter is changed.</p>

<p>how can I keep the dropdown open even while the data is changing ?</p>

<pre><code>searchText.addTextChangedListener(new TextWatcher() {
        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            // TODO Auto-generated method stub

        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count,
                int after) {
            // TODO Auto-generated method stub

        }

        @Override
        public void afterTextChanged(Editable s) {
            if (s.length() &gt; 0) {
                searchPlacesTask.cancel(true);
                searchPlacesTask = new SearchPlacesTask();
                searchPlacesTask.execute(s.toString().replace(" ", "-"));
            } else {
                searchPlacesTask.cancel(true);
                searchPlacesTask = new SearchPlacesTask();
                searchPlacesTask.execute();
            }
        }
    });



private class SearchPlacesTask extends AsyncTask&lt;String, Void, PlacesAPIResult&gt; {

    @Override
    protected PlacesAPIResult doInBackground(String... params) {
        PlacesAPIResult result = new PlacesAPIResult();

        if (params.length &gt; 0) {
            places = PlacesAPIRestMethod.placeAutocomplete(params[0], currentLocation.getLatitude(), currentLocation.getLongitude(), 
                    500, null, result);
        } else {
            places = PlacesAPIRestMethod.placeSearch(currentLocation.getLatitude(), currentLocation.getLongitude(), 0, true, result);
        }

        return result;
    }

    @Override
    protected void onPostExecute(PlacesAPIResult result) {
        if (result.getResult() == PlacesAPIResult.OK) {
            adapter = new PlaceAdapter(ChooseLocationActivity.this, R.layout.locationrow, places);
            searchText.setAdapter(adapter);
            adapter.notifyDataSetChanged();
        }
    }
}
</code></pre>
