O'Reilly logo

Android Programming for Beginners by John Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Making the Note To Self app's settings persist

We have already learned how to save data to the device's memory. As we implement saving users' settings, we will also see again how we handle the CheckBox, RadioGroup, and RadioButton input.

Coding the SettingsActivity class

Most of the action will take place in the SettingsActivity.java file. So, click on the appropriate tab and we will add the code a bit at a time.

First, we need some member variables that will give us a working SharedPreferences and Editor reference. We also want a member variable to represent each of the users' settings options. We need one for sound (boolean for on or off) and int for their preferred animation option (fast, slow, or none). Furthermore, as you will see in the next ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required