Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { private static final String PREF_NAME = "pref_general"; /** * read long value from preference memory */ 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); } }