0
I’m not getting to insert a Fragmentactivity for tab Swiper:
@Override
public Fragment getItem(int position) {
switch (position) {case 0:
return new HomeActivity();
case 1:
return new ListaBancada();
}
return null;
}
class is Homeactivity inherits from Fragment, the Listed Fragmentactivity and the List Bench gives error in the code above, why? How to call a Activity there?
You can’t call it. The method
getItem()
returns aFragment
, which is different fromFragmentActivity
, that despite being an Activity that supports contain Fragments, it is still an Activity and not a Fragment. Fragments are one thing, activities are another.– Piovezan
And I can call this Activity inside the Fragment. the whole fact is that I have an Activity ready and I want to put in place this Fragment
– Emerson Barcellos
An Activity can contain Fragments, not the other way around. You will have to convert your Activity into a Fragment and use it on the switch.
– Piovezan
Okay Piovezan! I’m going to have to dig into this a lot more thank you once again.
– Emerson Barcellos
No problem. I posted an answer to your question for you to accept.
– Piovezan