Android Sqlite watch table for data updates
Say my application has a ListView
that displays information from a Sqlite database, using a SimpleCursorAdapter
. Other threads will be updating the relevant tables in the database, and the ListView
should update automatically.
The SimpleCursorAdapter
I create doesn't seem to be watching the database for updates. I call the following function after updating the table.
((CursorAdapter) this.getLi开发者_开发知识库stAdapter()).notifyDataSetChanged();
What is the best way to do this?
Using just a SimpleCursorAdapter you will need to call notifyDataSetChanged
on the ListView to force it to refresh.
精彩评论