Example usage for android.content SharedPreferences getString

List of usage examples for android.content SharedPreferences getString

Introduction

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

Prototype

@Nullable
String getString(String key, @Nullable String defValue);

Source Link

Document

Retrieve a String value from the preferences.

Usage

From source file:Main.java

public static String getSharedStringPref(Context context, String key, String dValue) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    return prefs.getString(key, dValue);
}

From source file:Main.java

public static String getStringFromPreference(Context context, String key) {
    SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
    return pref.getString(key, null);
}

From source file:Main.java

public static String getBindStr(Context context, String bindStr) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    return sp.getString(bindStr, "");
}

From source file:Main.java

public static String getString(Context ctx, String key, String defaultValue) {
    SharedPreferences sp = ctx.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
    return sp.getString(key, defaultValue);
}

From source file:Main.java

public static String getUserId(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    return sp.getString(PREF_ID, null);
}

From source file:Main.java

public static String getUserCourse(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    return sp.getString(PREF_COURSE, null);
}

From source file:Main.java

public static String getStoredToken(Context caller) {
    SharedPreferences prefs = caller.getSharedPreferences(AUTH_PREFS, 0);
    return prefs.getString(PREF_TOKEN, null);
}

From source file:Main.java

public static String getRole(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    return sp.getString(PREF_ROLE, null);
}

From source file:Main.java

public static String getUserPhoneNumber(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    return sp.getString(PREF_PHONE_NUMBER, null);
}

From source file:Main.java

public static String getSettingValue(Context context, String path, String key) {
    SharedPreferences settingInfo = context.getSharedPreferences(path, 0);
    String value = settingInfo.getString(key, null);
    return value;
}