hide a v4 fragment - Android User Interface

Android examples for User Interface:Fragment

Description

hide a v4 fragment

Demo Code


//package com.java2s;

public class Main {
    /**/*from w  w w .j  ava 2  s  .  c  o m*/
     * I hide a v4 fragment
     * @param frag
     * @param fragmentManager
     */
    public static void hideV4Fragment(android.support.v4.app.Fragment frag,
            android.support.v4.app.FragmentManager fragmentManager) {
        android.support.v4.app.FragmentTransaction ft = fragmentManager
                .beginTransaction();
        hideV4Fragment(frag, ft);
    }

    /**
     * I hide a v4 fragment
     * @param frag
     * @param ft
     */
    public static void hideV4Fragment(android.support.v4.app.Fragment frag,
            android.support.v4.app.FragmentTransaction fragmentTransaction) {
        if (frag != null) {
            fragmentTransaction.hide(frag);
            fragmentTransaction.commit();
        }
    }
}

Related Tutorials