Skip to content

Instantly share code, notes, and snippets.

@krupalshah
Last active June 4, 2017 20:20
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 krupalshah/e319b9e15ee2ea285e51661c174d54cb to your computer and use it in GitHub Desktop.
Save krupalshah/e319b9e15ee2ea285e51661c174d54cb to your computer and use it in GitHub Desktop.
helper for shared prefs - kotlin version - Final implementation usage
val prefs = defaultPrefs(this)
prefs[Consts.SharedPrefs.KEY] = "any_type_of_value" //setter
val value: String? = prefs[Consts.SharedPrefs.KEY] //getter
val anotherValue: Int? = prefs[Consts.SharedPrefs.KEY, 10] //getter with default value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment