SpUtils.java
979 Bytes
package com.polysoft.nafmii.utils;
import android.content.Context;
import android.content.SharedPreferences;
public class SpUtils {
private static final String SP_NAME = "NAFMII";
public static final String WEB_VERSION_KEY = "WEB_VERSION";
public static void putBoolean(String key, boolean val) {
SharedPreferences.Editor edit = getSpMgr().edit();
edit.putBoolean(key, val).commit();
}
public static boolean getBoolean(String key, boolean def) {
return getSpMgr().getBoolean(key, def);
}
public static void putString(String key, String val) {
SharedPreferences.Editor edit = getSpMgr().edit();
edit.putString(key, val).commit();
}
public static String getString(String key, String def) {
return getSpMgr().getString(key, def);
}
private static SharedPreferences getSpMgr() {
return CtxUtils.getApplication().getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
}
}