@Override
  protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue) {
    super.onSetInitialValue(restorePersistedValue, defaultValue);
    final int valueToDisplay;
    if (restorePersistedValue) {
      valueToDisplay = getPersistedInt(DEFAULT_SIZE_VALUE);
    } else {
      valueToDisplay = (Integer) defaultValue;
    }
    updateCurrentValue(valueToDisplay);
  }
A simple Preference containing a SeekBar in order to select a size
samples/scrollperf/src/main/java/com/facebook/samples/scrollperf/preferences/SizePreferences.java