replace With Back Stack - Android User Interface

Android examples for User Interface:Fragment

Description

replace With Back Stack

Demo Code


//package com.java2s;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;

public class Main {
    public static void replaceWithBackStack(FragmentManager fm,
            int container, Fragment fragment, String tag) {
        fm.beginTransaction().replace(container, fragment, tag)
                .addToBackStack(tag).commit();
    }//  w w w. ja  v a2s  .  c  o  m

    public static void replace(FragmentManager fm, int container,
            Fragment fragment, String tag) {
        fm.beginTransaction().replace(container, fragment, tag).commit();
    }
}

Related Tutorials