Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android notifyDataSetChanged for ExpandableListView not working

In my app I am working with ExpandableListView. I am using adapter which extends BaseExpandableListAdapter. I want to refresh the ExpandableListView.

My ExpandableListView consists of items with delete button which links with database. If I'll press the delete button that item is permanently deleted from db. But the listview is not refreshing at the same time. If I again run that activity its refreshing but not at same time. I am using

mAdapter.notifyDataSetChanged();

but its not working as I want. Why?

like image 573
Jyosna Avatar asked Oct 19 '11 07:10

Jyosna


2 Answers

I just called super on the following overridden method of the BaseExpandableListAdapter and since then the notifyDataSetChanged() works.

    @Override
    public void registerDataSetObserver(DataSetObserver observer) {
        super.registerDataSetObserver(observer);    
    }
like image 128
Cata Avatar answered Sep 28 '22 17:09

Cata


you can try to additionally call invalidateViews() on your ExpandableListView when refreshing.

like image 26
senola Avatar answered Sep 28 '22 19:09

senola