Esempio n. 1
0
    @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();
    }
Esempio n. 2
0
    @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()));
        }
      }
    }