Update Android ListActivity when list data changes?

前端 未结 3 1036
栀梦
栀梦 2021-02-04 07:32

I wanted to know how to refresh a ListActivity when I change/add data to it.

I first thought that ListAdapter would know when the list is chang

3条回答
  •  天命终不由人
    2021-02-04 08:03

    If you are using an ArrayAdapter, manipulate the contents of the list through the adapter -- do not touch the underlying list. There are add(), insert(), and remove() methods on ArrayAdapter.

    If you are using a CursorAdapter, run a requery() on the Cursor.

提交回复
热议问题