Skip to content Skip to sidebar Skip to footer

How To Save Checkboxes State With Onsaveinstancestate

I have an Alert Dialog that displays a couple of checkboxes(5 to be more exact). The check boxes filter 5 lists of markers that are displayed on my map, markers that are grouped in

Solution 1:

You can try the following.

@OverridepublicvoidonSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
    super.onSaveInstanceState(outState, outPersistentState);
    outState.putBoolean("checkbox1",true);
}

Solution 2:

"The default implementation takes care of most of the UI per-instance state for you by calling onSaveInstanceState() on each view in the hierarchy that has an id", check documentation.

So try to set ids to all your checkboxes.

Post a Comment for "How To Save Checkboxes State With Onsaveinstancestate"