rootKey); final Preference preference = findPreference("basic_preference"); preference.setPreferenceDataStore(dataStore); } private final PreferenceDataStore dataStore = new PreferenceDataStore() { @Override public void putString(String key, @Nullable String value) { super.putString(key, value); } … };