I m 动态地更新“FerCompleteTextView”和面临两个问题的Im。
在选定项目时,出现了新的悬 the事件,正如你在以下法典中看到的那样,有人要求获得新的选用物品,因此, on事件使自动裁审会再次显示下降! 是否有解决这一问题的清洁方法?
在我打电话通知DataSetChange()之前,从汽车上获得的结果是,如何做到这一点?
这部法律是:
AutoCompleteTextView acCountry = (AutoCompleteTextView)layout.findViewById(R.id.autoComplete);
final ArrayAdapter<RMAutoComplete.ListItem> countriesAdapter = new ArrayAdapter<RMAutoComplete.ListItem>(this.context,android.R.layout.simple_dropdown_item_1line);
acCountry.setAdapter(countriesAdapter);
acCountry.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (s.length() > 1)
{
new AsyncTask<String, Void, List<RMAutoComplete.ListItem>>(){
@Override
protected List<ListItem> doInBackground(String... params) {
List<ListItem> l = null;
try {
l = location.getCountryData(params[0]);
} catch (Exception e) {
Log.e(TAG,"error when getCountryData",e);
}
return l;
}
@Override
protected void onPostExecute(List<ListItem> countries) {
countriesAdapter.clear();
if (countries != null)
for (ListItem listItem : countries) {
countriesAdapter.add(listItem);
}
countriesAdapter.notifyDataSetChanged();
}
}.execute(s.toString());
}
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
public void afterTextChanged(Editable s) {}
}
);