Reputation: 1521
My Current Situation
I am working on an existing app that is using CustomFragment
derived from android.app.Fragment
. I want to add a new functionnality with a ViewPager
which will show my CustomFragments. For that I need to use a FragmentPagerAdapter
.
Oooh snap !
Here I am, importing android.support.v4.view.ViewPager
and android.support.v4.app.FragmentPagerAdapter
to achieve my goal. And now the funny part begins :
When I try to use my FragmentPagerAdapter
with my CustomFragment
, I get the classic error Type mismatch: cannot convert from android.app.Fragment to android.support.v4.app.Fragment
Knowing that I can't change the whole app fragments to android.support.v4.app.Fragment
, I searched and found that the android.support.v13.app.FragmentPagerAdapter
was made to use native fragments. Great !
Not great. When I try to import the v13 FragmentPagerAdapter, I get the error The import android.support.v13 cannot be resolved
. For the record, I checked in SDKManager what support version is installed : v19.0.1
I searched again, because of course I can't be the first one with that problem. I found that you can't use support.v4
and support.v13
in the same app because v4 is included in v13. And for everyone that encoutered my problem, the solution was to use only android.support.v4.app.FragmentPagerAdapter
and android.support.v4.app.Fragment
What to do now ?
Since I have to use android.app.Fragment
and I can't use only support.v4, I don't know where to go search next. Any help would be highly appreciated !
Upvotes: 3
Views: 2068
Reputation: 1521
Well that is simply not possible. I went to use support.v4.app.Fragment.
Upvotes: 1