List of usage examples for android.content SharedPreferences edit
Editor edit();
From source file:Main.java
public static void setLatitude(Context context, String latitude) { SharedPreferences sp = getSP(context); SharedPreferences.Editor editor = sp.edit(); editor.putString("latitude", latitude); editor.apply();/* w w w.ja va 2 s.c om*/ }
From source file:Main.java
public static void putInt(Context context, String key, int value) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); prefs.edit().putInt(key, value).apply(); }
From source file:Main.java
public static void setName(Context context, String name) { SharedPreferences sp = getSP(context); SharedPreferences.Editor editor = sp.edit(); editor.putString("name", name); editor.apply();/* www . j a v a2 s. c o m*/ }
From source file:Main.java
public static void setIcon(Context context, String headIcon) { SharedPreferences sp = getSP(context); SharedPreferences.Editor editor = sp.edit(); editor.putString("icon", headIcon); editor.apply();//from ww w . j a v a 2s . com }
From source file:Main.java
public static void putInt(Context context, String key, int value) { SharedPreferences sp = context.getSharedPreferences("zexu", Context.MODE_PRIVATE); sp.edit().putInt(key, value).commit(); }
From source file:Main.java
public static void remove(Context context, String key) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); prefs.edit().remove(key).apply(); }
From source file:Main.java
public static void setAge(Context context, int age) { SharedPreferences sp = getSP(context); SharedPreferences.Editor editor = sp.edit(); editor.putInt("age", age); editor.apply();/*from ww w . java2 s . c o m*/ }
From source file:Main.java
public static void putString(Context context, String key, String values) { SharedPreferences sp = context.getSharedPreferences("7Yan", context.MODE_PRIVATE); sp.edit().putString(key, values).commit(); }
From source file:Main.java
public static void putBoolean(Context context, String key, boolean value) { SharedPreferences sp = context.getSharedPreferences("tron", Context.MODE_PRIVATE); sp.edit().putBoolean(key, value).commit(); }
From source file:Main.java
public static void putBoolean(Context context, String key, boolean values) { SharedPreferences sp = context.getSharedPreferences("7Yan", context.MODE_PRIVATE); sp.edit().putBoolean(key, values).commit(); }