Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { private static final String PREF_NAME = "pref_general"; /** * save boolean value to preference memory */ public static void saveBoolean(Context context, String key, boolean value) { if (context == null) return; SharedPreferences pref = context.getSharedPreferences(PREF_NAME, 0); SharedPreferences.Editor editor = pref.edit(); editor.putBoolean(key, value); editor.commit(); } }