replace Fragment No Stack - Android User Interface

Android examples for User Interface:Fragment

Description

replace Fragment No Stack

Demo Code


import android.support.v4.app.FragmentManager;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;

public class Main{
    public static void replaceFragmentNoStack(AppCompatActivity activity,
            Fragment fragment, int containerId) {
        FragmentManager fragmentManager = activity
                .getSupportFragmentManager();

        fragmentManager.beginTransaction().replace(containerId, fragment)
                .addToBackStack(null).commit();
    }//from   w  ww . j  av  a 2s  .  co  m
}

Related Tutorials