Open smahs opened 10 years ago
I had a similar problem when deleting an item. One of the buttons in the expanded child was a delete button that removes a Person object from my people ArrayList and is supposed to remove that entire row from the list. Here is what I did in onClick:
people.remove(position);
adapter = new PersonArrayAdapter(people);
list.setAdapter(adapter);
((ActionSlideExpandableListView) list).collapse();
At first, instead of lines 2 and 3 above, I was just calling:
((ArrayAdapter<String>) adapter).notifyDataSetChanged();
but this results in a bug where the delete button in the new row that moves up to fill that space has its text left-justified.
So essentially I'm recreating the adapter with the modified ArrayList, then re-setting the new adapter to the list.
If anyone has a better solution for this I would like to hear it too!
Have you found a solution for this one?
For a dynamic listview, issuing
does not recreate the listview. Am I missing something?