Preference's onCreateView is being called multiple times in Android

300 views Asked by At

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

Below is my xml file. I am adding this preference file in 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>
0

There are 0 answers