我在自动完成文本视图中显示列表视图。这意味着自动完成文本视图中的任何类型我只需在List-view.Next中添加该字符串,当我输入相同的名称字符串时那时自动完成文本视图我想将该字符串检查到我的列表视图项,如果字符串字符串匹配,则不要将其添加到列表视图中。
这是我的代码。何实现这一点。
userAutoComplete_TextView = (AutoCompleteTextView) findViewById(R.id.autoComplete_UserList);
userAutoComplete_TextView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, userlist));
userAutoComplete_TextView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
String foundItem = arg0.getItemAtPosition(arg2).toString();
Log.e("Updated ListView --->", "" + foundItem);
Filter filter = new Filter();
filter.setName(foundItem);
filter.setStrUserId(strInsId);
filter_ArrayList.add(filter);
if (!filter_ArrayList.contains(userAutoComplete_TextView.getText().toString().trim()))
{
String strAutoCompletetextview = userAutoComplete_TextView.getText().toString().trim();
Log.e("strAutoComplete", "textview = " + strAutoCompletetextview);
filterAdapter = new FilterAdapter(Filter_Screen.this, R.layout.filter_list_item, filter_ArrayList);
listView_Filter.setAdapter(filterAdapter);
}
}
});
先谢谢。