Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { public static String PREFERENCE_NAME = "CY"; public static boolean putString(Context context, String key, String value) { SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = settings.edit(); editor.putString(key, value); return editor.commit(); } }