Created
July 20, 2022 10:26
-
-
Save wajahatkarim3/9ae005143a39c1a102badcbe2aa6a0ae to your computer and use it in GitHub Desktop.
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
val preferences = getSharedPreferences("normal_prefs", MODE_PRIVATE) | |
// Storing Data in Preferences | |
with(preferences.edit()) { | |
putBoolean("Bool", true) | |
putString("String", "Some normal string value") | |
putInt("Integer", 10) | |
commit() | |
} | |
// Reading data from Preferences | |
val boolValue = preferences.getBoolean("Bool", false) | |
val strValue = preferences.getString("String", "") | |
val intValue = preferences.getInt("Integer", 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment