Arrayadapter, Listview, Creating And Updating Contents
I posting this again, trying to make the question/problem clearer: ListView lv; List- items; Localstorage ls; RemoteStorage rs; ItemArrayAdapter adapter; ... getShoppi
Solution 1:
Use ((ItemArrayAdapter)lv.getAdapter()).notifyDataSetChanged()
instead of adapter.notifyDataSetChanged()
Update:
The thing is that notifyDataSetChanged()
works only when the data inside the adapter has changed, and it rerenders the list. In your case you change the data externally, so you have to change the data inside the adapter.
You will need to replace nlist.add(...)
with insert()
and remove()
methods of the adapter: official reference
Some clarification on how it works: when you initialize adapter, it just sticks the items array you've passed to it to it's own ones. It is not aware of the changes made to your items array anymore.
Post a Comment for "Arrayadapter, Listview, Creating And Updating Contents"