tags:

views:

104

answers:

2

I have a Cursor that returns rows I use with a SimpleCursorAdapter to populate a ListView. I would like to filter some of the rows so they don't get displayed in my ListView. I use the data from the rows elsewhere in my Activity so I don't want to change my SQL to filter them with a WHERE clause.

What is the best way to keep a row from being displaying in my ListView? Ideally I would check a column in my row and then only add rows to the ListView that satisfy a condition.

A: 

Here is another question of this kind on Stackoverflow

Vinay
+3  A: 

Create a CursorWrapper and override the move...() methods to convert positions in the filtered set (which is what the ListView will see) and positions in the actual Cursor. Then, use your CursorWrapper in the SimpleCursorAdapter.

CommonsWare