samedi 23 mai 2015

Fragment replacement errors

I'm trying to replace a fragment of mine but I'm unable to do so because of these error. However I already have these imports, hence I've no idea what's wrong here.

Error 1

Error:(73, 96) error: incompatible types
required: android.support.v4.app.FragmentTransaction
found:    android.app.FragmentTransaction

Error 2

Error:(72, 48) error: incompatible types
required: Fragment
found:    FragmentMap

Imports

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;

Fragment replacing code

Fragment newFragment = new FragmentMap();
FragmentTransaction transaction = getFragmentManager().beginTransaction();

transaction.replace(R.id.detail_container, newFragment);
transaction.addToBackStack(null);
transaction.commit();

enter image description here

Aucun commentaire:

Enregistrer un commentaire