Answers for "storing a double in sharedpreferences"

0

storing a double in sharedpreferences

Editor putDouble(final Editor edit, final String key, final double value) {
   return edit.putLong(key, Double.doubleToRawLongBits(value));
}

double getDouble(final SharedPreferences prefs, final String key, final double defaultValue) {
return Double.longBitsToDouble(prefs.getLong(key, Double.doubleToLongBits(defaultValue)));
}
Posted by: Guest on December-05-2020

Browse Popular Code Answers by Language