Organizing Preferences

The preferences framework provides some support for you to organize your preferences into categories. If you have a lot of preferences, for example, you can build a view that shows high-level categories of preferences. Users could then drill down into each category to view and manage preferences specific to that group.

Using PreferenceCategory

You can implement something like this in one of two ways. You can introduce nested PreferenceScreen elements within the root PreferenceScreen, or you can use PreferenceCategory elements to get a similar result. Figure 13–5 and Listing 13–8 show how to implement the first technique, grouping preferences by using nested PreferenceScreen elements.

The view on the left in Figure 13–5 ...

Get Pro Android 4 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.