The onCreateView preference is called multiple times in Android

I have a PreferenceScreen that contains multiple Preference objects. The first preference inside PreferenceScreen is preferred. Now the problem is that onCreateView () for that custom preference is being called multiple times. If I change the order of preferences, it only gets called once. Why is this behavior?

Below is my xml file. I add this preference file to the PreferenceFragment.

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >

    <com.android.view.CustomPreference
        android:key="pref0" />

    <Preference
        android:key="pref1"
        android:layout="@layout/preferences_row_view" />

    <Preference
        android:key="pref2"
        android:layout="@layout/preferences_row_view" />

    <Preference
        android:key="pref3"
        android:layout="@layout/preferences_row_view" />

</PreferenceScreen>

      

+3


source to share





All Articles