Last active
August 29, 2015 14:18
-
-
Save StKotok/3bc987ec9d204a683448 to your computer and use it in GitHub Desktop.
Read/Write preferences example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static final String PREFERENCES_FILE = "preferences.txt"; | |
SharedPreferences preferences = this.getSharedPreferences(PREFERENCES_FILE, MODE_PRIVATE); | |
String pref1Value = preferences.getString("PREF_1", ""); // This get value of PREF_1 key | |
SharedPreferences.Editor edit = preferences.edit(); | |
edit.putString("key", "value"); // This put value to PREF_1 key | |
edit.commit(); // This write preferences to disk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment