コード例 #1
0
  @Override
  protected Parcelable onSaveInstanceState() {
    final Parcelable superState = super.onSaveInstanceState();

    // Create instance of custom BaseSavedState
    final SavedState myState = new SavedState(superState);
    // Set the state's value with the class member that holds current setting value
    myState.value = mCurrentValue;
    return myState;
  }
コード例 #2
0
  @Override
  protected Parcelable onSaveInstanceState() {
    final Parcelable superState = super.onSaveInstanceState();
    if (isPersistent()) {
      // No need to save instance state since it's persistent
      return superState;
    }

    final SavedState myState = new SavedState(superState);
    myState.value = getValue();
    return myState;
  }
コード例 #3
0
  @Override
  protected Parcelable onSaveInstanceState() {
    // save the instance state so that it will survive screen orientation changes and other events
    // that may temporarily destroy it
    final Parcelable superState = super.onSaveInstanceState();

    // set the state's value with the class member that holds current setting value
    final SavedState myState = new SavedState(superState);
    myState.minValue = getMinValue();
    myState.maxValue = getMaxValue();
    myState.value = getValue();

    return myState;
  }