Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { public static final String CONFIG_SP = "config_sp"; private static SharedPreferences mSp; private static SharedPreferences getPrefences(Context context) { if (mSp == null) { mSp = context.getSharedPreferences(CONFIG_SP, Context.MODE_PRIVATE); } return mSp; } }