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