SimpleCursorAdapter's old constructor deprecated.. really?

后端 未结 5 1818
春和景丽
春和景丽 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:45

    I know this thread is old, but you could just add a last parameter into the SimpleCursorAdapter object creation. Just add ", 0".

    It's a flag that Android likes and the warning goes away.

    Example:

    SimpleCursorAdapter dataAdapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.item_list_layout, cursor, fromDB(), toLayout(), 0);
    

提交回复
热议问题