Source:
private void setupSimplePreferencesScreen() { if (!isSimplePreferences(this)) { return; } addPreferencesFromResource(R.xml.pref_general); PreferenceCategory fakeHeader = new PreferenceCategory(this); fakeHeader.setTitle(R.string.pref_header_cloud_storage); getPreferenceScreen().addPreference(fakeHeader); addPreferencesFromResource(R.xml.pref_cloud_storage); fakeHeader = new PreferenceCategory(this); fakeHeader.setTitle(R.string.pref_header_display_options); getPreferenceScreen().addPreference(fakeHeader); addPreferencesFromResource(R.xml.pref_display); fakeHeader = new PreferenceCategory(this); fakeHeader.setTitle(R.string.pref_header_about); getPreferenceScreen().addPreference(fakeHeader); addPreferencesFromResource(R.xml.pref_about); fakeHeader = new PreferenceCategory(this); fakeHeader.setTitle(R.string.pref_header_privacy); getPreferenceScreen().addPreference(fakeHeader); addPreferencesFromResource(R.xml.pref_privacy); fakeHeader = new PreferenceCategory(this); fakeHeader.setTitle(R.string.pref_header_labs); getPreferenceScreen().addPreference(fakeHeader); addPreferencesFromResource(R.xml.pref_labs); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(findPreference("display_options_units").getContext()); bindPreferenceSummaryToValue(findPreference("cloud_storage_mongodb_uri")); bindPreferenceSummaryToValue(findPreference("cloud_storage_mongodb_device_status_collection")); bindPreferenceSummaryToValue(findPreference("cloud_storage_mongodb_collection")); bindPreferenceSummaryToValue(findPreference("cloud_storage_api_base")); bindPreferenceSummaryToValue(findPreference("acra.user.email")); bindPreferenceSummaryToValue(findPreference("display_options_units")); bindPreferenceSummaryToValue(findPreference("display_verticle_axis")); bindPreferenceSummaryToValue(findPreference("display_low_range")); bindPreferenceSummaryToValue(findPreference("display_high_range")); try { PackageInfo pInfo = null; pInfo = getPackageManager().getPackageInfo(getPackageName(), 0); findPreference("about_version_number").setSummary(pInfo.versionName); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } }

Target:
private void setupSimplePreferencesScreen() { if (!isSimplePreferences(this)) { return; } addPreferencesFromResource(R.xml.pref_general); PreferenceCategory fakeHeader = new PreferenceCategory(this); fakeHeader.setTitle(R.string.pref_header_cloud_storage); getPreferenceScreen().addPreference(fakeHeader); addPreferencesFromResource(R.xml.pref_cloud_storage); fakeHeader = new PreferenceCategory(this); fakeHeader.setTitle(R.string.pref_header_display_options); getPreferenceScreen().addPreference(fakeHeader); addPreferencesFromResource(R.xml.pref_display); fakeHeader = new PreferenceCategory(this); fakeHeader.setTitle(R.string.pref_header_about); getPreferenceScreen().addPreference(fakeHeader); addPreferencesFromResource(R.xml.pref_about); fakeHeader = new PreferenceCategory(this); fakeHeader.setTitle(R.string.pref_header_privacy); getPreferenceScreen().addPreference(fakeHeader); addPreferencesFromResource(R.xml.pref_privacy); fakeHeader = new PreferenceCategory(this); fakeHeader.setTitle(R.string.pref_header_labs); getPreferenceScreen().addPreference(fakeHeader); addPreferencesFromResource(R.xml.pref_labs); bindPreferenceSummaryToValue(findPreference("cloud_storage_mongodb_uri")); bindPreferenceSummaryToValue(findPreference("cloud_storage_mongodb_device_status_collection")); bindPreferenceSummaryToValue(findPreference("cloud_storage_mongodb_collection")); bindPreferenceSummaryToValue(findPreference("cloud_storage_api_base")); bindPreferenceSummaryToValue(findPreference("acra.user.email")); bindPreferenceSummaryToValue(findPreference("display_options_units")); bindPreferenceSummaryToValue(findPreference("display_verticle_axis")); bindPreferenceSummaryToValue(findPreference("display_low_range")); bindPreferenceSummaryToValue(findPreference("display_high_range")); try { PackageInfo pInfo = null; pInfo = getPackageManager().getPackageInfo(getPackageName(), 0); findPreference("about_version_number").setSummary(pInfo.versionName); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } }