<?xml version="1.0" encoding="utf-8"?><resources> <string-array name="selection_items"> <item>One</item> <item>Two</item> <item>Three</item> <item>Four</item> </string-array></resources>
Listing 5-34. Preferences Activity
//Note the package for this applicationpackage com.examples.sharepreferences;public class SettingsActivity extends PreferenceActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Load the preferences defaults on first run PreferenceManager.setDefaultValues(this, R.xml.preferences, false); addPreferencesFromResource(R.xml.preferences); }}
The settings values for this example application are manageable ...
Get Android Recipes: A Problem-Solution Approach for Android 5.0, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.