I do not know how to solve this problem, because I have to use both, but in different classes.
In the MainActivity I have two menus with:
import android.support.v4.app.Fragment;
…..
….
private class PagerAdapter extends FragmentPagerAdapter {
PagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
return new Uno();
case 1:
return new Dos();
case 2:
….
case 3:
….
case 4:
….
….
….
….
}
}
Class One, Two, ... extend from the Fragment class .
In these Fragment in some I can use the import android.support.v4.app.Fragment
and in others import android.app.Fragment
, because from what I have read to use the FragmentTransaction you need the import android.app.Fragment
So if in the Fragment I use import android.app.Fragment
in the menus of the MainActivity it shows me an error, and it tells me that in the Fragments I have a different import.
There is some way to have both of them.
Thank you.