I have a ListView populated via a CursorAdapter. I give my user the ability to alter the data in the list. For example, the user can mark a row as being unread (the data are messages).
Suppose my user marked a row unread. Would a proper implementation mark the row in the database as read and then requery the Cursor?
Yes, that’s the right answer. The
requery()will trigger an automatic update of yourCursorAdapter, which will trigger an automatic update of theListView, which will trigger an automatic smile from the user. 🙂UPDATE
The
requery()method is deprecated. A better approach nowadays is to run a query to get a freshCursor, then usechangeCursor()orswapCursor()on yourCursorAdapter.