remove Fragment From Activity - Android Activity

Android examples for Activity:Activity Fragment

Description

remove Fragment From Activity

Demo Code


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

public class Main {
    public static void removeFragmentFromActivity(
            @NonNull FragmentManager fragmentManager,
            @NonNull Fragment fragment) {
        FragmentTransaction transaction = fragmentManager
                .beginTransaction();/*from ww w  . j av a2  s  . c om*/
        transaction.remove(fragment);
        transaction.commit();
    }
}

Related Tutorials