replace Fragment - Android User Interface

Android examples for User Interface:Fragment

Description

replace Fragment

Demo Code


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

public class Main {
    public static void replaceFragment(final FragmentActivity activity,
            final int containerId, final Fragment fragment) {
        activity.getSupportFragmentManager().beginTransaction()
                .replace(containerId, fragment).commitAllowingStateLoss();
    }/*from ww w  .jav a2 s.com*/
}

Related Tutorials