5.4.10. preferences.xml for Specifying the App’s Settings

In this section, you’ll create the preferences.xml file that the SettingsFragment uses to display the app’s preferences. To create the file:

1. Right click the project’s res folder, then select New > Folder, in the Folder name field enter xml and click Finish.

2. Right click the xml folder, then select New > Android XML File to display the New Android XML File dialog.

3. In the File text field, enter the name preferences.xml.

4. Ensure that the Resource Type is set to Preference and the Root Element is PreferenceScreen, which represents a screen in which preferences are displayed.

5. Click Finish to create the file. If the IDE displays the raw XML, click the Structure tab at the bottom ...

Get Android™ How to Program, Second 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.