我的搜索视图可以过滤列表视图上的文本,但我过滤搜索视图上的数据点击项目并且数据保持显示我相同的数据无法过滤sqlite。我想念一些或更少的查询或需要链接什么?
sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
return false;
}
@Override
public boolean onQueryTextChange(String s) {
Ar_adapter.getFilter().filter(s);
return false;
}
});
ArrayList arrayList = appointmentList;
ArrayList<String> title2 = new ArrayList<String>();
for (int x = 0; x < arrayList.size(); x++) {
hashMap = (HashMap<String, String>) arrayList.get(x);
Log.i("HashMap 1 Value: ", hashMap.get("name"));
Log.i("HashMap 2 Value: ", hashMap.get("id"));
title2.add(hashMap.get("name"));
}
Ar_adapter = new ArrayAdapter<String>(this, R.layout.activity_listview, title2);
lv = (ListView) findViewById(R.id.listActivity);
lv.setAdapter(Ar_adapter);
lv.setOnItemClickListener(this);
}
@Override
public void onItemClick(AdapterView<?> adapterView, View v, int u, long l) {
Intent i = new Intent(this, DetailsActivity.class);
String lstr= String.valueOf(l);
i.putExtra("id",lstr);
startActivity(i);
}
}