Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { private static final String PREFERENCES_NAME = "PREFERENCES"; private static final String USER_PASSWORD = "USER_PASSWORD"; public static boolean saveUserPassword(Context context, String password) { return getEditor(context).putString(USER_PASSWORD, password).commit(); } private static SharedPreferences.Editor getEditor(Context context) { return getSharedPreferences(context).edit(); } private static SharedPreferences getSharedPreferences(Context context) { return context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE); } }