add And Hide Fragment - Android User Interface

Android examples for User Interface:Fragment

Description

add And Hide Fragment

Demo Code


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

public class Main {
    public static void addAndHideFragment(FragmentManager fm,
            int containerId, Fragment fragment, String tag) {
        fm.beginTransaction().add(containerId, fragment, tag)
                .hide(fragment).commitAllowingStateLoss();
    }//from  w w  w  .  j  a  v a 2s. com
}

Related Tutorials