FragmentActivity erreur de commutation... “Incompatible types” ou “FragmentTransaction ne peut pas être appliquée”

J'avais besoin de downgrade mon Interface à partir de 4.x 2.3.x.
4.x Interface a été conçue avec des Fragments et de travail. Pour rétrograder, j'ai changé à FragmentActivties, commutation de tout le nécessaire Soutien android la version v4.
Le problème est, le Fragment de l'interrupteur ne fonctionne pas.

Les importations sont:

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

Code d'erreur est le ft.remplacer(..), en gros il dit que j'ai besoin d'un Fragment de là, pas le MealsFragment.

   @Override
   public void onClick(DialogInterface dialog, int which) {

            MealsFragment newFragment = null;
            FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
            if (which == 0) {
                Log.e("CLick", "CLICKED");
                newFragment = newMealsFragment();
                MealsFragment.meals = 1;

            } else if (which == 1) {
                changeFragment1 = new MeasurementFragment();
                MeasurementFragment.dia = 1;
            }

            ft.replace(R.id.fl_content_frame, newFragment);
            ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
            ft.commit();
        }

    });

Erreur dans AndroidStudio:

replace(int, android.support.v4.app.Fragment) in FragmentTransition cannot be applied to (int, xx.xx.xx.ui.MealsFragment)

MealsFragment est un FragmentActivty

Logcat:

error: no suitable method found for replace(int,MealsFragment)
method FragmentTransaction.replace(int,Fragment,String) is not applicable
(actual and formal argument lists differ in length)
method FragmentTransaction.replace(int,Fragment) is not applicable
(actual argument MealsFragment cannot be converted to Fragment by method invocation conversion)

Si je change le newFragment à

android.support.v4.app.Fragment newFragment = null;

La nouvelle erreur types incompatibles se passe. Je suis à la commutation entre ces deux erreurs, mais je ne peux pas trouver une solution.

qu'est-ce que l'importation de fragment de classe

OriginalL'auteur broesel001 | 2014-03-05