title: How to Save and Retrieve Boolean Flags from Shared Preferences
body: <p>How to Save and Retrieve boolean flags in Shared Preference. I tried below thing but doesn't seem to be working </p>
  
  <p>Save : </p>
  
  <pre><code>SharedPreferences prefs = activity.getSharedPreferences(PREFERENCES_EULA, Activity.MODE_PRIVATE);
  Boolean lock = prefs.edit().putBoolean("locked", true).commit();
  </code></pre>
  
  <p>Retrieve :</p>
  
  <pre><code>SharedPreferences prefes = PreferenceManager.getDefaultSharedPreferences(context);
  Boolean yourLocked = prefes.getBoolean("locked", false); 
  </code></pre>
  
  <p>should get "true" here as i am passing "true" while saving</p>