コード例 #1
0
 public E getPreferenceValue(final SharedPreferences prefs, final E defValue) {
   if (!prefs.contains(key)) {
     prefs.edit().putString(key, defValue.getResValue()).commit();
   }
   return EnumUtils.getByResValue(enumClass, prefs.getString(key, null), defValue);
 }
コード例 #2
0
 public EnumPreferenceDefinition(final Class<E> enumClass, final int keyRes, final int defValRef) {
   super(keyRes);
   this.enumClass = enumClass;
   this.defValue =
       EnumUtils.getByResValue(enumClass, BaseDroidApp.context.getString(defValRef), null);
 }