Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; public class Main { public static boolean hasAccessToken(Context context) { return getAccessToken(context) != null; } private static String getAccessToken(Context context) { return getPreferences(context).getString("mastodon_token", null); } private static SharedPreferences getPreferences(Context context) { return PreferenceManager.getDefaultSharedPreferences(context); } }