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 file and complete the following steps:

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

Get Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.