Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.SharedPreferences; public class Main { public static final String CVALUE = "cvalue"; public static final String CITY = "city"; public static void putCity(Context context, String city) { SharedPreferences preferences = context.getSharedPreferences(CITY, Context.MODE_PRIVATE); preferences.edit().putString(CVALUE, city).commit(); } }