Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.SharedPreferences; public class Main { private static final String KEY_SHARED_PREFS = "com.stephentuso.welcome"; private static final String KEY_HAS_RUN = "welcome_screen_has_run"; public static boolean welcomeScreenCompleted(Context context, String welcomeScreenKey) { return getCompletedFromPreferences(getSharedPrefs(context), welcomeScreenKey); } private static boolean getCompletedFromPreferences(SharedPreferences preferences, String welcomeScreenKey) { return preferences.getBoolean(getKey(welcomeScreenKey), false); } private static SharedPreferences getSharedPrefs(Context context) { return context.getSharedPreferences(KEY_SHARED_PREFS, Context.MODE_PRIVATE); } private static String getKey(String welcomeKey) { return KEY_HAS_RUN + welcomeKey; } }