Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { private static final String PREF_NAME = "mypref"; /** * save string to preference memory */ public static void saveString(Context context, String key, String value) { if (context == null) return; SharedPreferences pref = context.getSharedPreferences(PREF_NAME, 0); SharedPreferences.Editor editor = pref.edit(); editor.putString(key, value); editor.commit(); } }