Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; public class Main { private static final String PREF_GENDER = "gender"; public static void setUserGender(final Context context, final String gender) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); sp.edit().putString(PREF_GENDER, gender).commit(); } }