Skip to content

Instantly share code, notes, and snippets.

@juliuscanute
Created May 28, 2020 11:00
Show Gist options
  • Save juliuscanute/2fca48addce30a166bc44809eb5aa9eb to your computer and use it in GitHub Desktop.
Save juliuscanute/2fca48addce30a166bc44809eb5aa9eb to your computer and use it in GitHub Desktop.
Android Settings
actual class Settings(context: Context, name: String = "multi-config") {
private var sharedPreference: SharedPreferences = context.getSharedPreferences(name, MODE_PRIVATE)
/*..*/
actual fun getInt(key: String, defaultValue: Int): Int =
sharedPreference.getInt(key, defaultValue)
/*..*/
actual fun putInt(key: String, value: Int) {
sharedPreference.edit()
.putInt(key, value)
.apply()
}
/*..*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment