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:com.google.android.gcm.GCMRegistrar.java

/**
 * Gets the current backoff counter./*from  w ww.  j  av  a2s. c o  m*/
 *
 * @param context application's context.
 * @return current backoff counter, in milliseconds.
 */
static int getBackoff(Context context) {
    final SharedPreferences prefs = getGCMPreferences(context);
    return prefs.getInt(BACKOFF_MS, DEFAULT_BACKOFF_MS);
}

From source file:com.breadwallet.tools.manager.SharedPreferencesManager.java

public static int getStartHeight(Activity context) {
    SharedPreferences settingsToGet = context.getSharedPreferences(BRConstants.PREFS_NAME, 0);
    return settingsToGet.getInt(BRConstants.START_HEIGHT, 0);
}

From source file:com.breadwallet.tools.manager.SharedPreferencesManager.java

public static int getLastBlockHeight(Activity context) {
    SharedPreferences settingsToGet = context.getSharedPreferences(BRConstants.PREFS_NAME, 0);
    return settingsToGet.getInt(BRConstants.LAST_BLOCK_HEIGHT, 0);
}

From source file:com.breadwallet.tools.manager.SharedPreferencesManager.java

public static int getCurrencyUnit(Activity context) {
    SharedPreferences settingsToGet = context.getSharedPreferences(BRConstants.PREFS_NAME, 0);
    return settingsToGet.getInt(BRConstants.CURRENT_UNIT, BRConstants.CURRENT_UNIT_BITS);
}

From source file:cn.count.easydriver366.base.AppSettings.java

static public void restore_login_from_device(Context context) {
    SharedPreferences prefs = context.getSharedPreferences(AppSettings.AppTile + "_login",
            Context.MODE_PRIVATE);
    userid = prefs.getInt("userid", -1);
    isLogin = prefs.getBoolean("isLogin", false);
    username = prefs.getString("username", "");
    update_time = prefs.getInt("update_time", 4 * 60 * 60);
}

From source file:com.phonemetra.account.util.AccountUtils.java

public static int getMinimumAppVersion(Context context) {
    SharedPreferences prefs = context.getSharedPreferences(Account.SETTINGS_PREFERENCES, Context.MODE_PRIVATE);
    return prefs.getInt(Account.MINIMUM_APP_VERSION, -1);
}

From source file:com.breadwallet.tools.manager.SharedPreferencesManager.java

public static int getLimit(Activity activity) {
    SharedPreferences prefs = activity.getSharedPreferences(BRConstants.PREFS_NAME, Context.MODE_PRIVATE);
    return prefs.getInt(BRConstants.LIMIT_PREFS, BRConstants.HUNDRED_BITS);
}

From source file:com.cyanogenmod.account.util.CMAccountUtils.java

public static int getMinimumAppVersion(Context context) {
    SharedPreferences prefs = context.getSharedPreferences(CMAccount.SETTINGS_PREFERENCES,
            Context.MODE_PRIVATE);
    return prefs.getInt(CMAccount.MINIMUM_APP_VERSION, -1);
}

From source file:com.wikonos.fingerprint.activities.MainActivity.java

public static void setSentFlags(String filename, int mode, Context context) {
    SharedPreferences prefs = context.getSharedPreferences("REVIEW_SENT_PREFS", MODE_PRIVATE);
    //See if a flag is already there
    int flag = prefs.getInt(filename, 0);
    if (flag == 1 && mode == 2)
        mode = 3; //Was sent, now emailed as well
    if (flag == 2 && mode == 1)
        mode = 3; //Was emailed, now sent as well
    prefs.edit().putInt(filename, mode).commit();
}

From source file:de.schaeuffelhut.android.openvpn.Preferences.java

public final static int getMgmtPort(Context context, File configFile) {
    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
    return sharedPreferences.getInt(Preferences.KEY_CONFIG_MGMT_PORT(configFile), -1);
}