Code example for SharedPreferences

Methods: getBoolean

	protected void onCreate(Bundle savedInstanceState) {
		mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
		mLockPatternUtils = new LockPatternUtils(this);
        mLockPatternUtils.setVisiblePatternEnabled(mPrefs.getBoolean("patternlock_visible_pattern", true));
        mLockPatternUtils.setTactileFeedbackEnabled(mPrefs.getBoolean("patternlock_tactile_feedback", false));
	protected void onPause() { 
		// Don't do anything if no lock pattern is set 
		if (!mLockPatternUtils.isLockPatternEnabled()) return;
        Save the current time If a lock pattern has been set 
        If this activity never loaded set the lock time to 
        10 seconds ago. 
        This is to prevent the following scenario: 
            1. Activity Starts  
            2. Lock screen is displayed