Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { private static final String PREF_NAME = "mypref"; /** * read string from preference memory */ public static String getString(Context context, String key, String defValue) { if (context == null) return defValue; SharedPreferences settings = context.getSharedPreferences(PREF_NAME, 0); return settings.getString(key, defValue); } }