Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { public static long ReadSharedPreferencesLong(Context context, String name, String key, long defaultvalue) { try { SharedPreferences userInfo = context.getSharedPreferences(name, Context.MODE_WORLD_READABLE); return userInfo.getLong(key, defaultvalue); } catch (NullPointerException e) { e.printStackTrace(); return 0; } } }