Example usage for android.content SharedPreferences edit

List of usage examples for android.content SharedPreferences edit

Introduction

In this page you can find the example usage for android.content SharedPreferences edit.

Prototype

Editor edit();

Source Link

Document

Create a new Editor for these preferences, through which you can make modifications to the data in the preferences and atomically commit those changes back to the SharedPreferences object.

Usage

From source file:Main.java

private static void accept(SharedPreferences preferences) {
    preferences.edit().putBoolean(PREFERENCE_INSTRUCTIONS_READ, true).commit();
}

From source file:Main.java

public static void setSupportEmail(String supportMail, SharedPreferences preferences) {

    preferences.edit().putString("SUPPORT_MAIL", supportMail).commit();

}

From source file:Main.java

public static void clear(Context context, final SharedPreferences p) {
    final Editor editor = p.edit();
    editor.clear();/*  w w w  .  ja  va 2  s  .com*/
    editor.commit();
}

From source file:Main.java

public static void clearPreference(Context context, final SharedPreferences p) {
    final Editor editor = p.edit();
    editor.clear();//from  www .java  2s  .c  o m
    editor.commit();
}

From source file:Main.java

public static void saveBooleanValue(Context context, SharedPreferences sp, String key, boolean value) {
    sp.edit().putBoolean(key, value).commit();
}

From source file:Main.java

public static void saveValue(Context context, SharedPreferences sp, String key, String value) {
    sp.edit().putString(key, value).commit();
}

From source file:Main.java

private static void setString(Context context, String value, String key) {
    SharedPreferences sp = getSharedPreferences(context);
    sp.edit().putString(key, value).apply();
}

From source file:Main.java

public static void saveLastNewsfeedUpdate(String last_update, SharedPreferences sPref) {
    SharedPreferences.Editor ed = sPref.edit();
    ed.putString(SAVED_LastNewsfeedUpdate, last_update);
    ed.commit();//www. j  a  v a  2s  .  c  o m
}

From source file:Main.java

public static void saveLastPodcastUpdate(String last_update, SharedPreferences sPref) {
    SharedPreferences.Editor ed = sPref.edit();
    ed.putString(SAVED_LastPodcastUpdate, last_update);
    ed.commit();//w  w  w .  jav  a2  s . c  om
}

From source file:Main.java

public static void saveLastPDFListUpdate(String last_update, SharedPreferences sPref) {
    SharedPreferences.Editor ed = sPref.edit();
    ed.putString(SAVED_LastPDFListUpdate, last_update);
    ed.commit();/*from w ww.  jav  a 2  s.  c o m*/
}