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 getLastLoadTime(Context context) {
    SharedPreferences share = context.getSharedPreferences("loaddataTime", context.MODE_PRIVATE);
    return share.getLong("time", 0);
}

From source file:Main.java

public static long getLong(Context mContext, String name, String key, long defaultValue) {
    SharedPreferences sharedPreferences = mContext.getSharedPreferences(name, Context.MODE_PRIVATE);
    return sharedPreferences.getLong(key, defaultValue);
}

From source file:Main.java

public static long getLongPref(Context context, String name, long def) {
    SharedPreferences prefs = context.getSharedPreferences(APPLICATION_NAME, Context.MODE_PRIVATE);
    return prefs.getLong(name, def);
}

From source file:Main.java

public static long getLastSyncAttemptedTime(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    return sp.getLong(PREF_LAST_SYNC_ATTEMPTED, 0L);
}

From source file:Main.java

public static long getLastSyncSucceededTime(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    return sp.getLong(PREF_LAST_SYNC_SUCCEEDED, 0L);
}

From source file:Main.java

public static long getCurSyncInterval(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    return sp.getLong(PREF_CUR_SYNC_INTERVAL, 0L);
}

From source file:Main.java

public static double getDouble(final SharedPreferences prefs, final String key, final double defaultValue) {
    return Double.longBitsToDouble(prefs.getLong(key, Double.doubleToLongBits(defaultValue)));
}

From source file:Main.java

public static long getCanelNotificationTime(Context context) {
    long time = 0;
    if (context != null) {
        SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
        time = settings.getLong("cancel_time", System.currentTimeMillis());
    }/* ww  w  .j av  a2 s  .  co  m*/
    return time;
}

From source file:ru.orangesoftware.financisto.export.flowzr.FlowzrSyncOptions.java

public static FlowzrSyncOptions fromPrefs(SharedPreferences preferences) {
    long lastSyncLocalTimestamp = preferences.getLong(PROPERTY_LAST_SYNC_TIMESTAMP, 0);
    String useCredential = preferences.getString(PROPERTY_USE_CREDENTIAL, "");
    String rootFolderId = preferences.getString(PROPERTY_ROOT_FOLDER_ID, "");
    String appVersion = preferences.getString(PROPERTY_APP_VERSION, "");
    return new FlowzrSyncOptions(useCredential, lastSyncLocalTimestamp, null, rootFolderId, appVersion);
}

From source file:Main.java

public static void saveDate(Context context) {
    SharedPreferences sp = context.getSharedPreferences("upushlog_time", Context.MODE_PRIVATE);
    if (0 == sp.getLong("time", 0)) {
        sp.edit().putLong("time", System.currentTimeMillis()).commit();

    }/*  ww w  .  jav a 2s .c  o  m*/

}