简体   繁体   中英

Forcing AutoCompleteTextView dropdown List

I am making an Async request to download some data once the data is downloaded i clear the old list and add the new items in the onPostExecute() of the Async to the adapter of AutoCompleteTextView and I call

adapter.setNotifyOnChange(true);
adapter.notifyDataSetChanged();

But i am not able to show the dropdown again ?? Any suggestion would be most appreciated

I solved it here is the solution

All I needed was to reinitialze the variable and call the notify the dataset has changed

arrayAdapter =  new ArrayAdapter<String> (this,android.R.layout.select_dialog_item,newDownloadedList);
AutoCompleteTextView.setAdapter(arrayAdapter);
arrayAdapter.notifyDataSetChanged();

you can use this

   arrayAdapter =  new ArrayAdapter<String> 
   (this,android.R.layout.select_dialog_item,newList);
   AutoCompleteTextView.setAdapter(arrayAdapter);
   arrayAdapter.notifyDataSetChanged();

then call AutoCompleteTextView.showDropDown();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM