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 setStringPref(Context context, String key, String s) { SharedPreferences sharedPref = context.getSharedPreferences(THEME_PREFS, 0); SharedPreferences.Editor e = sharedPref.edit(); e.putString(key, s); e.commit(); } }