Skip to content

Instantly share code, notes, and snippets.

@mshirdel
Created May 5, 2014 06:07
Show Gist options
  • Save mshirdel/0e02ac1e090729a5ba63 to your computer and use it in GitHub Desktop.
Save mshirdel/0e02ac1e090729a5ba63 to your computer and use it in GitHub Desktop.
SharedPreferences settings;
settings = getSharedPreferences("PREF_NAME", Context.MODE_PRIVATE);
//get the sharepref
int id = settings.getInt("ID", 0);
//set the sharedpref
Editor editor = settings.edit();
editor.putInt("ID", "1");
editor.commit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment