O'Reilly logo

Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android by Michael Eierman, Jakob Iversen

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

Code the Page’s Behavior

The settings activity’s function is relatively simple. When a user presses one of the choices, that value is stored as a key/value pair in SharedPreferences. When the page is accessed, the activity reads the stored preferences and sets the RadioButtons to the stored value. The value stored in a SharedPreferences is used in ContactListActivity to sort the list of saved contacts.

Open the ContactSettingsActivity.java file and complete the following steps:

1. Copy the ImageButton initialization methods from the ContactActivity.java to the ContactSettingsActivity.java file so that the navigation bar will work. These methods are initMapButton(), initListButton(), and initSettingsButton(). Paste this code before the last

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