How to use CursorWrapper to filter Cursor rows
Asked Answered
W

1

3

I want to filter out some rows returned by a Cursor based on a specific condition (which I want to test after receiving the rows from the database, because it's not easy to add it to a WHERE clause in the SQL query). I found the following related questions: Filter rows from Cursor so they don't show up in ListView, Filtering a cursor the right way?, and How to hide specific rows of a Cursor in android. I want to implement exactly what those questions are asking.

While the answers to those questions show how to implement a CursorWrapper (which I have done), I don't know how to then link that CursorWrapper to the Cursor & CursorAdapter. The answers just say "Then, use your CursorWrapper in the SimpleCursorAdapter" - can someone elaborate on what this means? Specifically, where do you instantiate the CursorWrapper class and how do you use it in conjunction with the CursorAdapter?

Thanks.

Wad answered 27/6, 2013 at 2:15 Comment(0)
P
1

CursorWrapper implements the Cursor interface, so you can pass your CursorWrapper to your CursorAdapter in place of your Cursor.

Pneumatograph answered 27/6, 2013 at 3:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.