Android SimpleCursorAdapter doesn't update when database changes

后端 未结 6 915
夕颜
夕颜 2020-11-28 04:48

I have an Android ListActivity that is backed by a database Cursor through a SimpleCursorAdapter.

When the items are clicked,

6条回答
  •  旧时难觅i
    2020-11-28 05:06

    requery() is already deprecated, just implement the simple updateUI() method like this in your CursorAdapter's child class and call it after data updates:

    private void updateUI(){
        swapCursor(dbHelper.getCursor());
        notifyDataSetChanged();
    }
    

提交回复
热议问题