我有一个ListView,它使用以下代码在OnCreate中填充SQLite查询,然后设置OnItemClickListener。
ListView menuList = (ListView) findViewById(R.id.ListView_Menu);
String sql = "SELECT EXHIBITORS, ('Stand No. ' || STANDNO) AS STANDNO, _ID FROM EXHIBITOR ORDER BY EXHIBITORS";
cursor = myDbHelper.getReadableDatabase().rawQuery(sql, null);
startManagingCursor(cursor);
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.menu_item, cursor, FROM, TO);
menuList.setAdapter(adapter);
menuList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View itemClicked, int position, long id) {
但是,我希望能够过滤ListView,然后修改查询,以便用户可以通过请求所有以字母“A”开头的参展商来减小ListView的大小。我怎么能这样做,我假设再次使用上面的代码但是我如何保持OnItemClickListener的工作呢?