RadioButton : RadioButon is a two state button that can be checked or unchecked. If a radio button is unchecked then a user can check it by simply clicking on it. Once a RadioButton is checked by a user it can’t be unchecked by simply pressing the same button. It will automatically unchecked when you press any other RadioButton within same RadioGroup.

Step 1: Open up Android Studio Project through res -> layout -> activity_main.xml (or) main.xml and add below code or just drag and drop the switch to design XML file.

Step 2:Add below code in to handle events on switch.
Step 3: Open res -> values -> strings.xml.