PreferenceActivity , PreferenceFragment and headers (Part 2)
In previous post we described how to use Preference Activity and Preference Fragment. Android 3.0 (API Level 11) introduced Preference Headers through which we can show the user the list of headers, and upon clicking on a header, show the fragment. A great benefit to using this design is that PreferenceActivity automatically presents the two-pane layout when running on large screens. This behavior is particularly useful if you have more than 10 preferences, otherwise I suggest the direction of displaying headers all of the time. Scenario 3: Preference Headers Step 1: Define the preferences_headers_scenario3.xml This file lists each settings group and declares which fragment contains the corresponding list of settings.The file is placed in the res\xml folder. With the android:fragment attribute, each header declares an instance of PreferenceFragment that should open when the user selects the header. Step 2: Create the Preference Activity To d