Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { private static SharedPreferences sp; public static void putInt(Context context, String key, int value) { if (sp == null) { sp = context.getSharedPreferences("config", Context.MODE_PRIVATE); } sp.edit().putInt(key, value).commit(); } }