Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { public static final String PREFS_KEY_MODE = "prefs_key_mode"; /** * Method to set the new assumed Mode of the active session * * @param context * @param mode The new assumed Mode of the active session */ public static void setActiveSessionMode(Context context, int mode) { SharedPreferences prefs = context.getSharedPreferences(context.getPackageName(), Context.MODE_PRIVATE); prefs.edit().putInt(PREFS_KEY_MODE, mode).commit(); } }