Exemplo n.º 1
0
 /**
  * Update a boolean preference with the new value. Displays some text to the user dependending on
  * the preference.
  */
 void updateBooleanPreference(
     boolean newSettingEnabled,
     BooleanPreference booleanPreference,
     String enabledText,
     String disabledText) {
   booleanPreference.set(newSettingEnabled);
   if (newSettingEnabled) {
     Toast.makeText(this, enabledText, Toast.LENGTH_LONG).show();
   } else {
     Toast.makeText(this, disabledText, Toast.LENGTH_LONG).show();
   }
   invalidateOptionsMenu();
 }
Exemplo n.º 2
0
 void initMenuItem(MenuItem menuItem, BooleanPreference preference) {
   menuItem.setChecked(preference.get());
 }