Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; public class Main { public static long fetchLongSharePref(Context context, String key) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences.Editor prefsEditor = preferences.edit(); return preferences.getLong(key, -1); } }