How to update ListView in case of CursorAdapter usage?

后端 未结 6 861
北荒
北荒 2020-12-09 10:11

The reason I\'m asking that is because requery() is deprecated. What is the best way now to refresh your ListView?

6条回答
  •  难免孤独
    2020-12-09 10:54

    The only thing that helped me, was to initialise new cursor, similar as previous one like:

    cursor = dbHelper.myDataBase.rawQuery(StaticValues.SQL_CAT, null);
    
    newCursor = dbHelper.myDataBase.rawQuery(StaticValues.SQL_CAT, null);
    

    and then call:

    adapter.changeCursor(newCursor);
    

    that updated my listview.

提交回复
热议问题