Java tutorial
//package com.java2s; import android.content.Context; import android.preference.PreferenceManager; import java.util.HashSet; import java.util.Set; public class Main { public static final String LOGGED_IN_USER_PREFERENCE_KEY = "logged_in_user"; public static Set<String> getLoggedInUsers(Context context) { return PreferenceManager.getDefaultSharedPreferences(context).getStringSet(LOGGED_IN_USER_PREFERENCE_KEY, new HashSet<>()); } }