In this example XML Layout of a PreferenceScreen:

<PreferenceScreen
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:key="first_preferencescreen">
    <CheckBoxPreference
            android:key="wifi enabled"
            android:title="WiFi" />
    <PreferenceScreen
            android:key="second_preferencescreen"
            android:title="WiFi settings">
        <CheckBoxPreference
                android:key="prefer wifi"
                android:title="Prefer WiFi" />
        ... other preferences here ...
    </PreferenceScreen>
</PreferenceScreen> 

I noticed an android:key for both PreferenceScreens (nested in each other).

I couldn't find, however, any use for them in application code: The only keys used to access a value by program code are the ones of the actual elements: CheckBoxPreference, EditTextPreference, etc.

Can they be utilized for specifying in code "access the CheckBoxPreference that's in this PreferenceScreen and not the other"? i.e. hierarchical access?

If not, what is the purpose of the key for a PreferenceScreen? Must it be defined? Must it be unique?

Edit
Report