Example usage for android.app Activity getSharedPreferences

List of usage examples for android.app Activity getSharedPreferences

Introduction

In this page you can find the example usage for android.app Activity getSharedPreferences.

Prototype

@Override
    public SharedPreferences getSharedPreferences(String name, int mode) 

Source Link

Usage

From source file:Main.java

public static SharedPreferences getSharedPrefs(Activity activity) {
    return activity.getSharedPreferences(SETTINGS_FILE, Activity.MODE_WORLD_READABLE);
}

From source file:Main.java

public static boolean getSavePass(Activity act) {
    setting = act.getSharedPreferences("setting", 0);
    return setting.getBoolean("savepass", false);
}

From source file:Main.java

public static SharedPreferences getSetting(Activity act) {
    setting = act.getSharedPreferences("setting", 0);
    return setting;
}

From source file:Main.java

public static boolean UseMetricSystem(Activity a) {
    SharedPreferences sp = a.getSharedPreferences(FILE_KEY, Activity.MODE_PRIVATE);
    return sp.getBoolean(METRIC_KEY, false);
}

From source file:Main.java

public static boolean UseWendlerMax(Activity a) {
    SharedPreferences sp = a.getSharedPreferences(FILE_KEY, Activity.MODE_PRIVATE);
    return sp.getBoolean(WENDLER_KEY, false);
}

From source file:Main.java

private static boolean isAlreadyGetPhoneResolution(Activity activity) {
    SharedPreferences config = activity.getSharedPreferences("config", Context.MODE_PRIVATE);
    return config.getBoolean("isAlreadyGetPhoneResolution", false);
}

From source file:Main.java

private static int[] readCache(Activity activity) {
    SharedPreferences config = activity.getSharedPreferences("config", Context.MODE_PRIVATE);
    return new int[] { config.getInt("height", 0), config.getInt("width", 0) };
}

From source file:Main.java

public final static void removeUserPreferences(Activity context) {
    SharedPreferences sharedPref = context.getSharedPreferences("currentUser", Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = sharedPref.edit();
    editor.clear();/*from   w w w. ja  v  a2  s.  co m*/
    editor.commit();
}

From source file:Main.java

public static void SetMetricSystem(Activity a, boolean value) {
    SharedPreferences sp = a.getSharedPreferences(FILE_KEY, Activity.MODE_PRIVATE);
    SharedPreferences.Editor ed = sp.edit();
    ed.putBoolean(METRIC_KEY, value);/*from   w  ww.ja  v a2s .  co  m*/
    ed.commit();
}

From source file:Main.java

public static void SetWendlerMax(Activity a, boolean value) {
    SharedPreferences sp = a.getSharedPreferences(FILE_KEY, Activity.MODE_PRIVATE);
    SharedPreferences.Editor ed = sp.edit();
    ed.putBoolean(WENDLER_KEY, value);//w  w  w.  j  a  v  a 2s.co m
    ed.commit();
}