简体   繁体   中英

Should I use SimpleCursorAdapter

I am currently using this setup I heard it is not advised to use anymore as support has been discontinued.

setListAdapter(new SimpleCursorAdapter(this, 
                R.layout.testlist, cur, 
                displayFields, displayViews
));

According to the documentation the issue is not with using a SimpleCursorAdapter it's with the constructor you're using. Apparently it uses the UI thread for updates which can cause an application to appear sluggish or unresponsive. Use the constructor that includes the flags parameter to avoid getting the deprecation warning. Alternatively,

As an alternative, use LoaderManager with a CursorLoader

Edit

Flags used to determine the behavior of the adapter, as per CursorAdapter(Context, Cursor, int).

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