AutoCompleteTextView根据我输入的第4个字母,我设法管理了一个应该提供我数据库中找到的所有城镇(维尔)的城市。
该Async task运作良好,并得到正确的数据。
我的问题是DropDownList显示不是所有项目。通常,DB返回的20个表中只有1、2、3或4个。
所以我想出了,ACTV本身应该有一些自动过滤功能!我在这里检查了许多主题,以更新我的代码,但是我没有成功.... :-(
我不断收到错误,却不知道到底是什么问题!:-(
所以这是我的代码:
class MyActivity extends Activity implements AdapterView.OnItemClickListener
{
static class Ville
{
String id;
String name;
@Override
public String toString() { return this.name; }
};
ArrayAdapter<Ville> villeAdapter;
String villeAdapterFilter;
VilleUpdateTask villeAdapterUpdateTask;
AutoCompleteTextView villeText;
Ville selectedVille;
final TextWatcher textChecker = new TextWatcher() {
public void afterTextChanged(Editable s) {}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int before, …Run Code Online (Sandbox Code Playgroud)