Skip to content Skip to sidebar Skip to footer

Add Preferencefragment On Fragmentpageradapter

I use the last SDK to create an app with navigation type Tabs + Swipe and I want to put a PreferenceFragment on one of the tabs. The generated code is like : mSectionsPagerAdapter

Solution 1:

The issue is that ViewPager's getItem(..) method returns a support Fragment (i.e. android.support.v4.app.Fragment) rather than android.app.Fragment, which is what PreferenceFragments extend. Basically, a PreferenceFragment uses the non-support version of the APIs and so is incompatible with ViewPagers, and there is no support version of PreferenceFragment available.

Solution 2:

You can upgrade to a v13 pager which supports the android.app.Fragment. I gave a detailed answer on a similar question here.

Post a Comment for "Add Preferencefragment On Fragmentpageradapter"