Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { public static final String PREFS_KEY_PASSCODE = "prefs_key_passcode"; public static boolean isPasscodeSet(Context context) { SharedPreferences prefs = context.getSharedPreferences(context.getPackageName(), Context.MODE_PRIVATE); if (prefs.getString(PREFS_KEY_PASSCODE, null) != null) return true; else return false; } }