I have a ListView backed by a custom adapter based on a CursorAdapter.
The cursor I give it is based on a list of Notes in the database (each note is a DB row).
Everything works just fine until I delete a note from the database. I'm not sure how to properly update the cursor/adapter/listview to display the new data.
I've read conflicting posts on using adapter.notifyDataSetChanged()
vs cursor.requery()
to refresh the UI, but neither of them seems to work in this case. The only way I've been able to refresh it is by creating a new cursor from a new query and calling adapter.changeCursor(newCursor)
.
Could someone demonstrate the proper way to update the backing data and then the UI (with psuedocode if possible).