Android ListView setAdapter(newA) and leave old ones in ListView more the new, it is possible?
I have a scenario where i list some items, and and the buttom i had a button to insert new item.
When i click i go to another view, and when i fill all editboxs i save it to database, and now i wanna go back to the list to see i开发者_JS百科f the item is in the list.
What i do is figure out if is some item new in database from last id in listview, and it is, but i return the new item as a cursor.
So my problem is:
I have an existing adapter with older items, and i wanna attach the newly adapter (or item), but i wanna use my costum adapter that encapsules the logic of what ids and columns from cursor i wanna bind.. and i wanna just add the items provided from the last cursor to the old one.
How can i do it?
u gonna wanna want youradapter.notifyDataSetChanged()
How do older items stores in your custom adapter? If they are in e.g. ArrayList you, than can retrieve it, add new items in it and call notifyDataSetChanged()
精彩评论