Java tutorial
//package com.java2s; /* * This is the source code of VshGap for Android v. 1.4.x. * It is licensed under GNU GPL v. 2 or later. * You should have received a copy of the license in this archive (see LICENSE). * * Copyright Nikolai Kudashov, 2013-2014. */ import android.content.Context; import android.content.SharedPreferences; public class Main { public static final String THEME_PREFS = "theme"; public static void setBoolPref(Context context, String key, Boolean b) { SharedPreferences sharedPref = context.getSharedPreferences(THEME_PREFS, 0); SharedPreferences.Editor e = sharedPref.edit(); e.putBoolean(key, b); e.commit(); } }