tjerkw / Android-SlideExpandableListView

A better ExpandableListView, with animated expandable views for each list item
Apache License 2.0
1.98k stars 741 forks source link

Derived class did not call super.onsaveinstancestate() - SlideExpandableListView #34

Open MattWilliams89 opened 11 years ago

MattWilliams89 commented 11 years ago

I was using an ActionSlideExpandableListView in a fragment and when replacing this fragment, before the adapter to the ListView was set, I had the above Exception thrown.

I fixed the issue by changing the onSaveInstanceState() function in SlideExpandableListView to :

@Override
public Parcelable onSaveInstanceState() {
    if ( adapter != null )
    {
        return adapter.onSaveInstanceState(super.onSaveInstanceState());
    }
    else
    {
        return super.onSaveInstanceState();
    }
}

where it used to say "return null" in the else case. This fixed the issue for me

sergiandreplace commented 10 years ago

Worked for me too, otherwise it was crashing on going bakcground and coming back after the fragment has been destroyed. Should it be added to official code?