How to update ListView in case of CursorAdapter usage?

后端 未结 6 858
北荒
北荒 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:42

    This is what works for me, im not sure its the best way.

    c = db.rawQuery( "SELECT * FROM mytable", null); //same line of the first initialization
    adapter.swapCursor(c);
    

    I refresh the only cursor, I dont know what to do with a new one. Also i dont know pepole that answer with only a name of a function.

提交回复
热议问题