我在android中使用自定义列表视图执行搜索功能时出现此错误。
@Override
protected void publishResults(CharSequence constraint,
FilterResults results) {
mList = (ArrayList<Details>) results.values;
DetailsAdapter.this.notifyDataSetChanged();
});
答案 0 :(得分:0)
以下是我ListView
可能有帮助的例子:
adapter=new ArrayAdapter<String>(ModifyList.this, android.R.layout.simple_list_item_1,list);
lv.setAdapter( adapter);
a=adapter;
lv.setTextFilterEnabled(true);
search_et.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {
ModifyList.this.a.getFilter().filter(cs);
}
@Override
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
int arg3) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable arg0) {
// TODO Auto-generated method stub
}
});