Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.content.SharedPreferences; public class Main { private static final String NAME = "config"; /** * Put a key-value into config * @param context context * @param key the key * @param value the value */ public static void putInt(Context context, String key, int value) { SharedPreferences sp = context.getSharedPreferences(NAME, Context.MODE_PRIVATE); SharedPreferences.Editor edit = sp.edit(); edit.putInt(key, value).commit(); } }