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 getInt(Context context, String key) {
    SharedPreferences sp = context.getSharedPreferences("zexu", Context.MODE_PRIVATE);
    return sp.getInt(key, 0);
}

From source file:Main.java

static public int getIntegerPreferences(Context context, String key) {
    SharedPreferences pref = context.getSharedPreferences("pref", Context.MODE_PRIVATE);
    return pref.getInt(key, 0);
}

From source file:Main.java

public static int getInt(String preName, Context context, String key) {
    SharedPreferences pre = context.getSharedPreferences(preName, Context.MODE_PRIVATE);
    return pre.getInt(key, -1);
}

From source file:Main.java

public static int getInt(Context context, String title) {
    SharedPreferences sp = context.getSharedPreferences(FILENAME, Context.MODE_PRIVATE);
    return sp.getInt(title, 0);
}

From source file:Main.java

public static int lineLength(Context context) {
    SharedPreferences sp = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE);
    return sp.getInt(KEY_LL, DEFAULT_LINE_LENGTH);
}

From source file:Main.java

public static int getChangeMode(Context ctx) {
    SharedPreferences sp = ctx.getSharedPreferences("config_mode", Context.MODE_PRIVATE);
    return sp.getInt(Mode, MODE_DAY);
}

From source file:Main.java

public static int getTextSizePrefs(Context context, String key) {
    SharedPreferences sp = context.getSharedPreferences(PRE_NAME, Context.MODE_PRIVATE);
    return sp.getInt(key, 2);

}

From source file:Main.java

public static int balloonCount(Context context) {
    SharedPreferences sp = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE);
    return sp.getInt(KEY_BC, DEFAULT_BALLOON_COUNT);
}

From source file:Main.java

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

From source file:Main.java

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