androidfilterandroid-listviewandroid-cursoradapter

Filter a listview populated by cursor adapter


I populated a listview with cursor adapter which contains rows from a database.

I want filter the items of the listview, but when I do with:

list.getFilter().filter(String);

it doesn't work.

How can I filter the items by cursor?


Solution

  • From the code, it seems like the CursorAdapter expects a query, not a plain string, see line 49.

    EDIT:

    Nevermind, you need to first initialize your query provider with a call to setFilterQueryAdapter().