What is the easiest way to save and load this variable using shared preferences (kotlin)?
var score = 12.5
And yes the score variable is a double not int.
What is the easiest way to save and load this variable using shared preferences (kotlin)?
var score = 12.5
And yes the score variable is a double not int.
To put inside:
with(PreferenceManager.getDefaultSharedPreferences(this).edit()){
putDouble("SCORE",score)
apply()
}
To retrieve:
val score = PreferenceManager.getDefaultSharedPreferences(this).getDouble("SCORE",0.0)