简体   繁体   中英

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 ?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM