Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 493
Vahan Avatar asked Jul 31 '12 12:07

Vahan


1 Answers

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.

like image 56
atermenji Avatar answered Nov 15 '22 16:11

atermenji