Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences.Editor; public class Main { private static final String PREF_NAME = "toppatch"; private static final String USER_LOGGED_IN = "user_logged_in"; public static void setUserLoggedIn(Context context) { Editor edit = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE).edit(); edit.putBoolean(USER_LOGGED_IN, true); edit.commit(); } }