[英]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我正在发出
Async
请求以在下载数据后下载一些数据我清除旧列表并将Async
的onPostExecute()
中的新项目添加到 AutoCompleteTextView 的适配器,然后我调用
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();
然后调用
AutoCompleteTextView.showDropDown();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.