This snippet from the topic lacks the call to write back the changes saved in editor to the sharedPreferences object. Write down the missing line of code using any of the two methods serving this purpose.
textView.text = sharedPreferences.getString("theme", "default") + " theme"
switch.setOnCheckedChangeListener { _, isChecked ->
editor.putString("theme", if (isChecked) "red" else "default")
// Add the missing line of code
}
switch.isChecked = sharedPreferences.getString("theme", "default") == "red"