Example usage for android.content SharedPreferences getLong

List of usage examples for android.content SharedPreferences getLong

Introduction

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

Prototype

long getLong(String key, long defValue);

Source Link

Document

Retrieve a long value from the preferences.

Usage

From source file:Main.java

public static long getSettingLongValue(Context context, String path, String key) {
    SharedPreferences settingInfo = context.getSharedPreferences(path, 0);
    long value = settingInfo.getLong(key, 0l);
    return value;
}

From source file:Main.java

/**
 * read long value from preference memory
 *///from  w ww  .  j a  va  2  s . c o m
public static long getLong(Context context, String key, long defValue) {
    if (context == null)
        return defValue;
    SharedPreferences settings = context.getSharedPreferences(PREF_NAME, 0);
    return settings.getLong(key, defValue);
}

From source file:Main.java

public static long getLastRefreshTime(Context context, String string) {
    SharedPreferences dePreferences = context.getSharedPreferences("refresh_time", 0);
    return dePreferences.getLong(string, 0);
}

From source file:Main.java

public static long getLastSync(Context context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    return prefs.getLong(LASTSYNC_PARAM, 0);
}

From source file:Main.java

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

From source file:Main.java

public static long getLastUsedTimestamp(Context context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    return prefs.getLong(LASTUSED_PARAM, 0);
}

From source file:Main.java

public static long getLongPreference(Context context, String preferenceName, String key) {
    SharedPreferences sharedPreferences = context.getSharedPreferences(preferenceName, 0);
    return sharedPreferences.getLong(key, 0);
}

From source file:Main.java

public static long flyDuration(Context context) {
    SharedPreferences sp = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE);
    return sp.getLong(KEY_BD, DEFAULT_FLY_DURATION);
}

From source file:Main.java

public static long getSharedPreferencesLong(Context context, String key, long _default) {
    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
    return preferences.getLong(key, _default);
}

From source file:Main.java

public static double getDouble(SharedPreferences pref, String key, double defVal) {
    return Double.longBitsToDouble(pref.getLong(key, Double.doubleToLongBits(defVal)));
}