添加方法

This commit is contained in:
mazengfei
2025-11-07 15:18:15 +08:00
parent 55ba11bf34
commit 4231c68cdc
@@ -44,6 +44,18 @@ public class PrefUtils {
sp.edit().putInt(key, value).commit();
}
public static long getLong(Context ctx, String key, long defaultValue) {
SharedPreferences sp = ctx.getSharedPreferences(PREF_NAME,
Context.MODE_PRIVATE);
return sp.getLong(key, defaultValue);
}
public static void setLong(Context ctx, String key, long value) {
SharedPreferences sp = ctx.getSharedPreferences(PREF_NAME,
Context.MODE_PRIVATE);
sp.edit().putLong(key, value).commit();
}
public static float getFloat(Context ctx, String key, float defaultValue) {
SharedPreferences sp = ctx.getSharedPreferences(PREF_NAME,
Context.MODE_PRIVATE);