Example usage for android.content SharedPreferences getInt

List of usage examples for android.content SharedPreferences getInt

Introduction

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

Prototype

int getInt(String key, int defValue);

Source Link

Document

Retrieve an int value from the preferences.

Usage

From source file:Main.java

public static int getIntValue(Context context, String name, int defValue) {
    SharedPreferences pref = getPref(context, DEF_PREF_NAME);
    return pref.getInt(name, defValue);
}

From source file:Main.java

public static int getInt(Context context, String key, int defValue, String spName) {
    SharedPreferences sp = getSharedPreferences(context, spName);
    return sp.getInt(key, defValue);
}

From source file:Main.java

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

From source file:Main.java

public static int getIntegerSharedPreferences(Context context, String name, String key, int defaultValue) {
    SharedPreferences preferences = context.getSharedPreferences(name, 0);
    return preferences.getInt(key, defaultValue);
}

From source file:Main.java

public static boolean havePortScreen(Context context) {
    SharedPreferences sp = context.getSharedPreferences("port_size", 0);
    if (sp.getInt("height", 0) != 0)
        return true;
    else {/*from   w w  w. j a  v  a 2 s  .c  o  m*/
        return false;
    }
}

From source file:Main.java

public static boolean haveLandScreen(Context context) {
    SharedPreferences sp = context.getSharedPreferences("land_size", 0);
    if (sp.getInt("height", 0) != 0)
        return true;
    else {/*w w w  . ja  v  a  2s. c  o m*/
        return false;
    }
}

From source file:Main.java

public static int getIValue(Context context, String strKey) {

    SharedPreferences exam_info = context.getSharedPreferences("exam", 0);

    return exam_info.getInt(strKey, 0);
}

From source file:Main.java

public static int getSharedPreferencesInt(Context context, String key, int _default) {
    SharedPreferences preferences = context.getSharedPreferences(PREFS_NAME, 0);
    return preferences.getInt(key, _default);
}

From source file:Main.java

public static int getSettingIntValue(Context context, String path, String key) {
    SharedPreferences settingInfo = context.getSharedPreferences(path, 0);
    int value = settingInfo.getInt(key, 0);
    return value;
}

From source file:Main.java

public static int getHours(SharedPreferences prefs) {
    if (prefs.contains(PREFS_HRS)) {
        return prefs.getInt(PREFS_HRS, DEFAULT_HRS);
    } else {// w w w.j  a  v a  2 s.  c  o  m
        return DEFAULT_HRS;
    }
}