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 getUsrname(Context context) {

    return context.getSharedPreferences(XL_PREFERENCES, Context.MODE_PRIVATE).getString("usrnmae", null);
}

From source file:Main.java

private static String getUserId(Context context) {
    sp = context.getSharedPreferences("loginRes", 0);
    String userId = sp.getString("userId", "");
    return userId;
}

From source file:Main.java

public static String getSessionid(Context context) {

    return context.getSharedPreferences(XL_PREFERENCES, Context.MODE_PRIVATE).getString("sessionid", null);
}

From source file:Main.java

public static String getUID(Context context) {

    return context.getSharedPreferences(XL_PREFERENCES, Context.MODE_PRIVATE).getString("userid", null);
}

From source file:Main.java

public static SharedPreferences settingsReader(Context context) {
    return context.getSharedPreferences("preferences", 0);
}

From source file:Main.java

public static SharedPreferences getPreferences(Context context) {
    return context.getSharedPreferences("prefshops", Context.MODE_PRIVATE);
}

From source file:Main.java

public static SharedPreferences getPref(Context context) {
    return context.getSharedPreferences("marsroot", 0);
}

From source file:Main.java

private static SharedPreferences preferences(Context context) {
    return context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
}

From source file:Main.java

/**
 * @param context/*  ww w  .j  a v  a  2 s . co  m*/
 * @return
 */
public static SharedPreferences getSharedPreferences(Context context) {
    return context.getSharedPreferences(context.getPackageName(), Activity.MODE_PRIVATE);
}

From source file:Main.java

public static void clearSP(Context context, String name) {
    context.getSharedPreferences(name, 0).edit().clear().commit();
}