ListView, SimpleCursorAdapter, an an EditText filter — why won't it do anything?

前端 未结 1 583
离开以前
离开以前 2020-12-05 10:23

I\'d like to filter a SimpleCursorAdapter-driven ListView with an EditText box right above it. I have the following code, but when I type in the box, nothing happens; the fu

1条回答
  •  情深已故
    2020-12-05 11:15

    Try this way:

    }  else  {
        String value = "%"+constraint.toString()+"%";
    
        return mDB.query(directoryPeople.PEOPLE_TABLE, asColumnsToReturn, "LAST_NAME like ? ", new String[]{value}, null, null, null);
    }
    

    I skipped the last argument because I don't know what it really should do:

    "CASE WHEN LAST_NAME like '" + constraint.toString() + "%' THEN 0 ELSE 1 END, LAST_NAME"
    

    Have you tried this query in shell in emulator?

    0 讨论(0)
提交回复
热议问题