Question

In the checkBoxPreference there is a key (android:key="show_airline_column_pref") and I know that this key is used when I want to store value for the checkbox (if it set or not). But my confusion comes with the prefScreen key (android:key="flight_columns_pref") , why this key exist ? What value should I store in a key of prefScreen ?

can someone explan me the usage of this key ? I couldnt find example when it is useful to store something in this key. can someone en-light me :) thanks

<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:key="flight_columns_pref"
android:title="Flight Search Preferences"
android:summary="Set Columns for Search Results">

<CheckBoxPreference
android:key="show_airline_column_pref"
android:title="Airline"
android:summary="Show Airline column" />

</PreferenceScreen>
Was it helpful?

Solution

PreferenceScreen has the key attribute because it is a subclass of Preference. It could be useful when you want to manage it programmatically, like hide it or add/hide childs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top