Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences.Editor; public class Main { private static final String FILE_NAME = "myName"; private static final String CITY_INFO = "cityName"; public static void putCityName(Context context, String cityName) { Editor editor = context.getSharedPreferences(FILE_NAME, Context.MODE_APPEND).edit(); editor.putString(CITY_INFO, cityName); editor.commit(); } }