Skip to content Skip to sidebar Skip to footer

Incompatilble Types In My Fragmentpageradapter

I get an error when I try to return a new fragment. I suspect it has something to do with the imports but I must be wrong using just Android's fragmentpageradapter does not change

Solution 1:

The problem is that the android.support.v4.app.FragmentPagerAdapter class can only be used with support Fragments, i.e. android.support.v4.app.Fragment.

You have two choices to fix it.

Choice 1) Make all of your Fragments android.support.v4.app.Fragment instances instead of android.app.Fragment instances.

Choice 2) Use the android.support.v13.app.FragmentPagerAdapter class from the v13 support library, which makes it possible to use regular Fragments, see documentation here.

Post a Comment for "Incompatilble Types In My Fragmentpageradapter"