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 getQQid(Context context) {
    SharedPreferences preferences = context.getSharedPreferences(QQ, Context.MODE_PRIVATE);
    String QQid = preferences.getString(QQ_ID, "");
    return QQid;/*w  ww . ja  va2  s.  c  om*/
}

From source file:Main.java

public static String getDefaultRingtone(Context context, int type) {
    SharedPreferences mSharePref = PreferenceManager.getDefaultSharedPreferences(context);
    String value = mSharePref.getString(TYPE_SYSTEM_PRIMER + type, "");
    return value;
}

From source file:Main.java

public static String getSwipeUpAppToLaunchPackageName(Context context) {
    SharedPreferences sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE);
    return sp.getString("swipeUpAppToLaunchPackageName", "");
}

From source file:Main.java

public static String getLAT(Context context) {
    SharedPreferences preferences = context.getSharedPreferences(LAT, Context.MODE_PRIVATE);
    String city = preferences.getString(CVALUE, "40.017349");
    return city;//w  w  w.  j  av a2 s  .  c  om
}

From source file:Main.java

public static String getLNG(Context context) {
    SharedPreferences preferences = context.getSharedPreferences(LNG, Context.MODE_PRIVATE);
    String city = preferences.getString(CVALUE, "116.40712");
    return city;// w  ww .ja  va  2 s .c  o  m
}

From source file:Main.java

public static String getPreference(Context context, String key, String defaultValue) {
    SharedPreferences pref = getPreferences(context);
    String value = pref.getString(key, defaultValue);
    if (value.length() == 0) {
        value = defaultValue;//ww  w. ja v a2 s. co m
    }
    return value;
}

From source file:Main.java

private static String getSharedPreCookie() {
    if (TextUtils.isEmpty(mCookie)) {
        SharedPreferences sp = app.getSharedPreferences("_cookie", Context.MODE_PRIVATE);
        mCookie = sp.getString(key, "");
    }//from   w ww . j a va 2 s . c o  m
    return mCookie;
}

From source file:Main.java

public static String getSwipeDownAppToLaunchName(Context context) {
    SharedPreferences sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE);
    return sp.getString("swipeDownAppToLaunchName", "");
}

From source file:Main.java

public static String getHomeBindingAppToLaunchName(Context context) {
    SharedPreferences sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE);
    return sp.getString("homeBindingAppToLaunchName", "");
}

From source file:Main.java

public static String getSwipeDownAppToLaunchPackageName(Context context) {
    SharedPreferences sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE);
    return sp.getString("swipeDownAppToLaunchPackageName", "");
}