I am adding a TextChangedListener to an AutocompleteTextView . In TextChangedListener afterTextChanged() I call AsyncTask , which downloads data from the Internet (downloading all data when the activity starts is not an option, since lists can be quite large, so it becomes just a waste of traffic). AsyncTask onPostExecute() looks like this (I use ArrayAdapter ):
@Override protected void onPostExecute(ArrayList<Subregion> result) { super.onPostExecute(result); if (result != null) { adapter.clear(); for (Iterator<Subregion> iterator = result.iterator(); iterator.hasNext();) { Subregion subregion = iterator.next(); adapter.add(subregion); } adapter.notifyDataSetChanged(); autocompleteTextView.showDropDown(); } }
Subregion is my custom object with override toString() . I want my program to start loading data when the user starts to print and show the results immediately after receiving and analyzing them.
My problem:
autocompleteTextView.showDropDown() no effect. onPostExecute() receives the correct list of data, they are added to the adapter, but showDropDown() does not display a drop-down list. What's the matter?
android autocompletetextview
Eugene chumak
source share