KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have an ExpandableListActivity (using a SimpleCursorTreeAdapter) which starts another activity when the user clicks on a child-element. When pressing the back-button in the new activity all the list-items are collapsed again. How do I save the expanded state of the ExpandableListActivity and restore it again. I already tried to implemented onSaveInstanceState() and onRestoreInstanceState() like this... @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); Parcelable listState = getExpandableListView().onSaveInstanceState(); outState.putParcelable("ListState", listState); } @Override protected void onRestoreInstanceState(Bundle state) { super.onRestoreInstanceState(state); Parcelable listState = state.getParcelable("ListState"); getExpandableListView().onRestoreInstanceState(listState); } ...but onRestoreInstanceState() gets never called. I also tried to restore the state in the onCreate() method but it isn't called as well: if (savedInstanceState != null) { Parcelable listState = savedInstanceState.getParcelable("ListState"); getExpandableListView().onRestoreInstanceState(listState); }
Tags (comma-separated)
Save Edits
Cancel