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 readRecords(int gameId, String key) {
    SharedPreferences mPerferences = PreferenceManager.getDefaultSharedPreferences(mContext);
    return mPerferences.getString(key, "");
}

From source file:Main.java

public static String getUserFromPrefrence(Context context) {
    SharedPreferences sh = context.getSharedPreferences("xmeet_prefrence", Context.MODE_PRIVATE);
    return sh.getString("nickname", "");
}

From source file:Main.java

public static String getSelectedAccount(Context context) {
    if (context == null)
        return "";
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    return prefs.getString(PREF_SELECTED_ACCOUNT, "");
}

From source file:Main.java

public static String getAccountID(final Context context, final String accountName) {
    SharedPreferences sp = getSharedPreferences(context);
    String userID = sp.getString(makeAccountSpecificPrefKey(accountName, PREFIX_PREF_USER_ID), "");
    return userID;
}

From source file:Main.java

public static String getSharedPreferences(Context context, String key) {
    SharedPreferences sharedPreferences = context.getSharedPreferences("VV_Tracker", 1);
    String value = sharedPreferences.getString(key, "");
    return value;
}

From source file:Main.java

public static String getActiveAccountName(final Context context) {
    SharedPreferences sp = getSharedPreferences(context);
    return sp.getString(PREF_ACTIVE_ACCOUNT, null);
}

From source file:Main.java

public static String getSettingString(final Context context, final String key, final String defaultValue) {
    final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
    return settings.getString(key, defaultValue);
}

From source file:Main.java

/** 
 * @param context The application context.
 * @return The stored sender ID or the default value if not available.
 *//* w w  w.  j  a  v a  2 s.c o  m*/
public static String getSenderId(Context context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    return prefs.getString(PREFS_KEY_SENDER_ID, DEFAULT_SENDER_ID);
}

From source file:Main.java

public static String getStringFromSharePrefs(Context context, String fileName, String key,
        String defaultValue) {// w w  w  .ja v a  2  s .co  m
    SharedPreferences preferences = context.getSharedPreferences(fileName, Context.MODE_PRIVATE);
    return preferences.getString(key, defaultValue);
}

From source file:Main.java

public static String getData(Context context, String key) {
    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
    return sharedPreferences.getString(key, "");
}