Skip to content Skip to sidebar Skip to footer

Updating Expandablelistview With Notifydatasetchanged()

First a short overview of my code, i hope its understandable: I have a class called ToDoElement with a few variables. I have another class called ToDoListe which manages the ToDoE

Solution 1:

You need to add a DeleteMethod of some sort to the Adapter and remove the item from the Adapter manually, not only remove it from the List.

Each time you refresh the the views using notifyDataSetChanged() the Adapter will call the loop around the List. Your List in the Adapter gets a null value due to the changes you made.

Solution 2:

Call super in your registerDataSetObserver meke notifyDataSetChanged() working well.

@OverridepublicvoidregisterDataSetObserver(DataSetObserver observer) {
    super.registerDataSetObserver(observer);    
}

Solution 3:

You should call expListAdapter.notifyDataSetInvalidated()

expListAdapter.notifyDataSetChanged() will just update your views for the new values for each items (no change in any of the elements)

i.e it will again call your getChildView and getGroupView for each item.

Solution 4:

In my case I was able to resolve this error by clearing the focus of the associated ExpandableListView before calling notifyDatasetChanged

Post a Comment for "Updating Expandablelistview With Notifydatasetchanged()"