Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { public static int getInt(String preName, Context context, String key) { SharedPreferences pre = context.getSharedPreferences(preName, Context.MODE_PRIVATE); return pre.getInt(key, -1); } }