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 changes, but when I have added elements to the list there is no update on the ListActivity, only when I close the ListActivity and reopen it again I see the changes occur.
So I searched for any method such as: update(), refesh() or something like that, but there is none.
It seems I haven't gotten the concept, can someone help me please?
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.
Try ArrayAdapter:notifyDataSetChanged
Google docs link
Maybe you should do this setListAdapter(listAdapter);
来源:https://stackoverflow.com/questions/1538796/update-android-listactivity-when-list-data-changes