Example usage for android.content Context getSharedPreferences

List of usage examples for android.content Context getSharedPreferences

Introduction

In this page you can find the example usage for android.content Context getSharedPreferences.

Prototype

public abstract SharedPreferences getSharedPreferences(File file, @PreferencesMode int mode);

Source Link

Document

Retrieve and hold the contents of the preferences file, returning a SharedPreferences through which you can retrieve and modify its values.

Usage

From source file:Main.java

public static String getSharedPreString(Context context, String key) {
    settings = context.getSharedPreferences(XML_Settings, Context.MODE_PRIVATE);
    return settings.getString(key, "");
}

From source file:Main.java

public static boolean getSharedPreBoolean(Context context, String key) {
    settings = context.getSharedPreferences(XML_Settings, 0);
    return settings.getBoolean(key, false);
}

From source file:Main.java

public static String getSwipeDownAppToLaunchName(Context context) {
    SharedPreferences sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE);
    return sp.getString("swipeDownAppToLaunchName", "");
}

From source file:Main.java

public static void putSharedPreferencesString(Context context, String key, String value) {
    context.getSharedPreferences(SP_FIRST_START, 0).edit().putString(key, value).commit();
}

From source file:Main.java

public static String getSwipeDownAppToLaunchName(Context context) {
    SharedPreferences sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE);
    return "";
}

From source file:Main.java

public static boolean getCameraActive(Context context) {
    SharedPreferences sd = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
    return sd.getBoolean(CAMERA_ACTIVE, false);
}

From source file:Main.java

/**
 * TODO: call this in your Application onCreate() to initialize a SharedPref object
 *
 * @param context your Application Context
 *///from   w ww.  j  a va  2s  .c  om
public static void initSharedPref(Context context) {
    sOAuthCredentials = context.getSharedPreferences("oauth", Context.MODE_PRIVATE);
}

From source file:Main.java

public static String getHomeBindingAppToLaunchName(Context context) {
    SharedPreferences sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE);
    return sp.getString("homeBindingAppToLaunchName", "");
}

From source file:Main.java

public static String getSwipeDownAppToLaunchPackageName(Context context) {
    SharedPreferences sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE);
    return sp.getString("swipeDownAppToLaunchPackageName", "");
}

From source file:Main.java

public static void saveBooleanPreferences(String key, boolean value, Context ctx) {
    SharedPreferences sp = ctx.getSharedPreferences(sharedPrefsFile, Context.MODE_PRIVATE);
    Editor edit = sp.edit();/*w w w .j a  v  a 2 s.  c  o m*/
    edit.putBoolean(key, value);
    edit.commit();
}