Skip to content

Instantly share code, notes, and snippets.

@loganj
Created June 30, 2010 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loganj/458626 to your computer and use it in GitHub Desktop.
Save loganj/458626 to your computer and use it in GitHub Desktop.
protected boolean persistBoolean(boolean value) {
if (shouldPersist()) {
if (value == getPersistedBoolean(!value)) {
// It's already there, so the same as persisting
return true;
}
SharedPreferences.Editor editor = mPreferenceManager.getEditor();
editor.putBoolean(mKey, value);
tryCommit(editor);
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment