androidsqliteflagssimplecursoradapterandroid-cursor

Which flag to use in SimpleCursorAdapter?


I use SimpleCursorAdapter to send data which I read from database to ListView.

SimpleCursorAdapter has 2 flags and one of them is deprecated.

Should I always use FLAG_CONTENT_OBSERVER?

Or is it better to use something else instead of SimpleCursorAdapter?


Solution

  • Read the docs on those flags. FLAG_AUTO_REQUERY is deprecated because with it Cursor queries are performed often in UI thread. You should try to use CursorLoader instead. CursorLoader can automatically requery and deliver data in a background thread. FLAG_REGISTER_CONTENT_OBSERVER is just registering a content observer on a cursor so you c receive notifications on new data.