添加方法
This commit is contained in:
@@ -44,6 +44,18 @@ public class PrefUtils {
|
|||||||
sp.edit().putInt(key, value).commit();
|
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) {
|
public static float getFloat(Context ctx, String key, float defaultValue) {
|
||||||
SharedPreferences sp = ctx.getSharedPreferences(PREF_NAME,
|
SharedPreferences sp = ctx.getSharedPreferences(PREF_NAME,
|
||||||
Context.MODE_PRIVATE);
|
Context.MODE_PRIVATE);
|
||||||
|
|||||||
Reference in New Issue
Block a user