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 getStr(Context mContext, String name, String key, String defaultValue) {
    SharedPreferences sharedPreferences = mContext.getSharedPreferences(name, Context.MODE_PRIVATE);
    return sharedPreferences.getString(key, defaultValue);
}

From source file:Main.java

public static String getStringPref(Context context, String name, String def) {
    SharedPreferences prefs = context.getSharedPreferences(APPLICATION_NAME, Context.MODE_PRIVATE);
    return prefs.getString(name, def);
}

From source file:Main.java

public static String getString(Context context, String key) {
    SharedPreferences preferences = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);

    return preferences.getString(key, "");
}

From source file:Main.java

private static String getBootServicesString(Context context) {
    SharedPreferences sharedPrefs = getSharedPreferences(context);

    return sharedPrefs.getString(KEY_BOOTSERVICES, "");
}

From source file:Main.java

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

From source file:Main.java

/****************** get shared preferences *******************/
public static String getPreferences(Context con, String key) {
    SharedPreferences sharedPreferences = con.getSharedPreferences("prefs_login", 0);
    String value = sharedPreferences.getString(key, "");
    return value;

}

From source file:Main.java

public static String getPhoneNumber(Context context) {
    SharedPreferences prefs = context.getSharedPreferences("LOGIN_preferences", Context.MODE_PRIVATE);
    return prefs.getString("PHONE", "");
}

From source file:Main.java

public static String getArea(Context ctx) {

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(ctx);

    String area = preferences.getString("selectedArea", "");
    return area;//  w  ww  .  jav a2 s . co  m
}

From source file:Main.java

public static String loadStringSavedPreferences(String key, Context ctx) {
    SharedPreferences sp = ctx.getSharedPreferences(sharedPrefsFile, Context.MODE_PRIVATE);
    String name = sp.getString(key, "");
    return name;//from   w w  w.j a  va2  s  . co  m
}

From source file:Main.java

public static String readLastAddress(Context context) {
    SharedPreferences sharedPreferences = context.getSharedPreferences("jomoo", Context.MODE_PRIVATE);
    return sharedPreferences.getString("last_address", "");
}