📜  在 sharedpreferences 中存储双精度 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:38.282000             🧑  作者: Mango

代码示例1
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)));
}