I have two Android Preference Screens defined in my Android app in XML.
For example, Screen 1
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:key="screen1">
<PreferenceCategory android:title="Preferences">
<CheckBoxPreference
android:defaultValue="true"
android:title="test"
android:key="test_pref"/>
</PreferenceCategory>
</PreferenceScreen>
and Screen 2
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:key="screen2">
<CheckBoxPreference
android:key="checkbox"
android:title="Checkbox">
</CheckBoxPreference>
</PreferenceScreen>
I would like screen 2 to be a separate screen to be accessible in its own right but I would also like its preferences to be a part of screen one also. Is there a simple way I can simply reference screen 2 from within screen 1? Or do I just need to essentially repeat the same preference stuff in a sub preference screen in Screen 1.
<include/>
tag? I'm not sure if it works for PreferenceScreen, but that is the way to include ordinary layouts within other layouts. See developer.android.com/resources/articles/… – Bioscope