Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; public class Main { public static long getLong(Context context, final String key, final long defaultValue) { final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); return settings.getLong(key, defaultValue); } }