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 getRegistrationId(Context context) {
    SharedPreferences prefs = getSharedPreference(context);
    return prefs.getString(REGISTRATION_ID, "");
}

From source file:Main.java

public static String getSessionid(Context context) {
    SharedPreferences prefs = getSharedPreference(context);
    return prefs.getString(SESSION_ID, "");
}

From source file:Main.java

public static String getThreeInOneCityUpdateTime(Context context) {
    SharedPreferences prefs = getSharedPreference(context);
    return prefs.getString(THREE_IN_ONE_UPDATE_TIME, "");
}

From source file:Main.java

public static String getAddressLibUpdateTime(Context context) {
    SharedPreferences prefs = getSharedPreference(context);
    return prefs.getString(ADDRESS_LIB_UPDATE_TIME, "1313185685414");
}

From source file:Main.java

public static String getValueFromSP(Context ctx, String Key) {
    SharedPreferences sp = ctx.getSharedPreferences("config_info", 0);
    return sp.getString(Key, "");
}

From source file:Main.java

public static String getStringValue(Context context, String key, String default_value) {
    SharedPreferences data = context.getSharedPreferences("config", 0);
    return data.getString(key, default_value);
}

From source file:Main.java

public static String getString(String key) {
    SharedPreferences preferences = getPrivateSharedPreference();
    return preferences.getString(key, null);
}

From source file:Main.java

public static String getRegistrationId(Context ctx) {
    SharedPreferences preferences = ctx.getSharedPreferences("PREFS", 0);
    return preferences.getString("registration_id", "no_registration_id_yet");
}

From source file:Main.java

public static int resolveListPrefInt(SharedPreferences pref, String key, int defaultValue) {
    String value = pref.getString(key, null);
    if (value == null) {
        return defaultValue;
    }//from  w  w  w . ja  v a  2s.co m
    return Integer.parseInt(value);
}

From source file:Main.java

public static String readWLPref(Context context, String prefName) {
    SharedPreferences prefs = context.getSharedPreferences("WLPrefs", 0);
    return prefs.getString(prefName, null);
}