List of usage examples for android.content Context getSharedPreferences
public abstract SharedPreferences getSharedPreferences(File file, @PreferencesMode int mode);
From source file:Main.java
public static boolean getBoolean(Context context, String key) { SharedPreferences sp = context.getSharedPreferences("andy", Context.MODE_PRIVATE); return sp.getBoolean(key, false); }
From source file:Main.java
public static String getConfig(Context context, String key) { SharedPreferences sp = context.getSharedPreferences("money", Activity.MODE_PRIVATE); return sp.getString(key, ""); }
From source file:Main.java
public static String getString(Context mContext, String key) { SharedPreferences sp = mContext.getSharedPreferences("atguigu", Context.MODE_PRIVATE); return sp.getString(key, ""); }
From source file:Main.java
public static int getInt(String preName, Context context, String key) { SharedPreferences pre = context.getSharedPreferences(preName, Context.MODE_PRIVATE); return pre.getInt(key, -1); }
From source file:Main.java
public static boolean isLocaleAlreadyIndexed(Context context, String locale) { return context.getSharedPreferences(INDEX, 0).getBoolean(locale, false); }
From source file:Main.java
public static String getString(Context context, String key) { SharedPreferences sp = context.getSharedPreferences("configdata", Context.MODE_PRIVATE); String result = sp.getString(key, null); return result; }
From source file:Main.java
public static void saveStartTime(Context paramContext) { SharedPreferences time = paramContext .getSharedPreferences("mobclick_agent_" + paramContext.getPackageName(), 0); Editor editor = time.edit().putLong("start_millis", System.currentTimeMillis()); editor.commit();/*w ww . ja va 2 s.c o m*/ }
From source file:Main.java
public static void putCityName(Context context, String cityName) { Editor editor = context.getSharedPreferences(FILE_NAME, Context.MODE_APPEND).edit(); editor.putString(CITY_INFO, cityName); editor.commit();//from w w w. j av a2 s . c o m }
From source file:Main.java
public static String readLastAddress(Context context) { SharedPreferences sharedPreferences = context.getSharedPreferences("jomoo", Context.MODE_PRIVATE); return sharedPreferences.getString("last_address", ""); }
From source file:Main.java
/** * Retrieves the number of milliseconds that the UpdateService sleeps. * /*from ww w . j av a2 s . com*/ * @param context * @return number of milliseconds to sleep before the next update */ public static int getUpdateInterval(Context context) { sharedPreferences = context.getSharedPreferences(PREFERENCES, Context.MODE_PRIVATE); int interval = sharedPreferences.getInt("UpdateInterval", DEF_INTERVAL); // Log.d(TAG, "New Interval: " + interval); return interval; }