How to launch PreferenceScreen from the parent one

1.7k views Asked by At

I've added in my app a simple AlertDialog that asks if the user wants to be redirected to the info PreferenceScreen. I'd like to know how to launch a child PreferenceScreen from the parent one.

Thanks.

2

There are 2 answers

2
user634618 On

I don't know what you mean by "info" PreferenceScreen, but when writing the preference xml file that you load in your PreferenceActivity subclass you can nest the PreferenceScreen tags:

<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orderingFromXml="true" >
    <PreferenceScreen
        android:title="Child preference screen"
        android:summary="Description">
        <CheckBoxPreference
            android:defaultValue="false"
            android:key="check1"
            android:title="Checkbox"
            android:summaryOff="off"
            android:summaryOn="on" />
        </PreferenceScreen>
</PreferenceScreen>

The child preference screen will be show automatically when touching the entry in the parent preference screeen.

0
GrAnd On

I've provided my solution for the similar question.