SimpleCursorAdapter's old constructor deprecated.. really?

后端 未结 5 1689
春和景丽
春和景丽 2021-02-06 02:20

Here it says that SimpleCursorAdapter\'s API level 1 constructor is deprecated and the use of LoaderManager and CursorLoader is recommende

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-06 02:44

    I believe CursorLoader is currently intended for use with a ContentProvider.

    If you wish to load directly from your database using the new framework; you can consider extending AsyncTaskLoader and returning it from onCreateLoader instead of using a CursorLoader.

    If you are using the existing methods you have to be more careful of how long your query operation will take. If your query will take noticable amounts of time consider using an AsyncTask to load the cursor (and be aware of requery running in the UI thread).

提交回复
热议问题