@Override public void onDestroy() { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.unregisterOnSharedPreferenceChangeListener(this); super.onDestroy(); SettingsManager.save(); }
@Override public void onDestroy() { PreferenceGroup prefGroup = getPreferenceScreen(); for (int i = 0; i < prefGroup.getPreferenceCount(); i++) { Preference pref = prefGroup.getPreference(i); if (pref instanceof CheckBoxPreference) { CheckBoxPreference checkBoxPref = (CheckBoxPreference) pref; SettingsManager.setPreferenceBoolean(checkBoxPref.getKey(), checkBoxPref.isChecked()); } } super.onDestroy(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.settings_emu_fragment); PreferenceGroup prefGroup = getPreferenceScreen(); for (int i = 0; i < prefGroup.getPreferenceCount(); i++) { Preference pref = prefGroup.getPreference(i); if (pref instanceof CheckBoxPreference) { CheckBoxPreference checkBoxPref = (CheckBoxPreference) pref; checkBoxPref.setChecked(SettingsManager.getPreferenceBoolean(checkBoxPref.getKey())); } } }