Incompatibility between android.app.Fragment and android.support.v4.app.Fragment

0

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.

    
asked by SoCu 25.09.2018 в 21:01
source

0 answers