更新时间:2023-10-14 15:54:34
requery()
更新 Cursor
,而不是 CursorAdapter
.正如你所说,它已被弃用,它的替代品是:
requery()
updates a Cursor
, not a CursorAdapter
. As you say, it has been deprecated, and its replacement is:
oldCursor = myCursorAdapter.swapCursor(newCursor); // hands you back oldCursor
或:
myCursorAdapter.changeCursor(newCursor); // automatically closes old Cursor
myCursorAdapter.notifyDataSetChanged()
通知 ListView
数据集已经改变,它应该自己刷新
myCursorAdapter.notifyDataSetChanged()
notifies the ListView
that the data set has changed, and it should refresh itself