<How to save switch state in Kotlin? (Android Stud...
# stackoverflow
u
How to save switch state in Kotlin? (Android Studio) I have a switch in my MainActivity that is used to toggle dark mode. I know how to save the state of the background but not the toggle switch. It keeps moving back to unchecked even when dark mode is activated. How would I save the state of the switch? override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) //shared preferences val appSettingPrefs : SharedPreferences =...