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 void setPosterToastFlag(Context context, boolean flag) { SharedPreferences sp = context.getSharedPreferences("poster_toast", Activity.MODE_PRIVATE); SharedPreferences.Editor tor = sp.edit(); tor.putBoolean("toast_flag", flag); tor.commit();//from w w w . j a v a 2 s . c o m }
From source file:Main.java
@SuppressLint("CommitPrefEdits") public static void resetAll(String fileName, Context context) { SharedPreferences sharedPreferences = context.getSharedPreferences(fileName, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.clear();//www . j a va2 s .c om editor.commit(); }
From source file:Main.java
public static void setUIScrollableWidgets(Context context, boolean value) { SharedPreferences sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sp.edit(); editor.putBoolean("uiScrollableWidgets", value); editor.commit();/*from www . ja va 2 s . c o m*/ }
From source file:Main.java
static String getSaveLocation(Context context, String saveName) { SharedPreferences prefs = context.getSharedPreferences("com.ihelp101.xinsta", Context.MODE_PRIVATE); return prefs.getString(saveName, "Instagram").replace("file://", "").replaceAll("%20", " "); }
From source file:Main.java
public static boolean isFirst(Context context) { SharedPreferences preferences = context.getSharedPreferences(APP_START_FIRST, Context.MODE_PRIVATE); boolean isFirst = preferences.getBoolean(APP_START_KEY, true); if (isFirst) { preferences.edit().putBoolean(APP_START_KEY, false).commit(); }/*from w w w .j a v a2 s. co m*/ return isFirst; }
From source file:Main.java
public static void setString(Context ctx, String key, String value) { SharedPreferences sp = ctx.getSharedPreferences("config", Context.MODE_PRIVATE); sp.edit().putString(key, value).commit(); }
From source file:Main.java
public static String getPersonGroupName(String personGroupId, Context context) { SharedPreferences personGroupIdNameMap = context.getSharedPreferences("PersonGroupIdNameMap", Context.MODE_PRIVATE); return personGroupIdNameMap.getString(personGroupId, ""); }
From source file:Main.java
private static SharedPreferences getPFBrowserPreferences(Context ctx) { SharedPreferences out = ctx.getSharedPreferences(BROWSER_PREFS, Context.MODE_PRIVATE); return out;/*from w w w .j a v a 2 s . co m*/ }
From source file:Main.java
private static SharedPreferences getPreferences(Context context) { if (sp == null) { sp = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE); }/*w w w . j a v a2 s .c om*/ return sp; }
From source file:Main.java
public static void setChangelogVersion(Context context, String version) { SharedPreferences sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sp.edit(); editor.putString("changelogReadVersion", version); editor.commit();// w w w . jav a 2 s . c o m }