We develop apps using Kotlin in Android Studio. I would like to use the button Switch to turn the setting on and off and use anko alerttwp to display an alert. How can I get on or off when the switch is changed?

I didn't know how to source code.