Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.SharedPreferences; public class Main { /** * Name of the authorization preferences file, for use with * {@link SharedPreferences}. */ public static final String AUTH_PREFS = "auth_pref"; /** * Name of the authorization token string in the preferences * file. */ public static final String PREF_TOKEN = "auth_token"; public static String getStoredToken(Context caller) { SharedPreferences prefs = caller.getSharedPreferences(AUTH_PREFS, 0); return prefs.getString(PREF_TOKEN, null); } }