Home>

Here I have a certain Switch, and it is located not on the main Activity (MainActivity), but on the second Activity (I called it SettingsActivity). As the name suggests, pressing a button opens a new action with the settings menu, where my Switch is located. Let's say I clicked on Switch and changed the value from false to true and clicked on the apply button, which will take me back to the main action. In the main action, I'll open the settings again, but the Switch slider is set to false again. Is there anything you can do to keep the Switch slider when I switch between actions and exit the application?

Please clarify your specific problem or provide more detailed information on what exactly you need. As it stands, it is difficult to understand exactly what you are asking.

Дух сообщества2021-09-27 10:30:34

google sharedpreferences. You can also save to a file, database, server, etc.

Alex_Skvortsov2021-09-27 10:33:31