Android examples for User Interface:Fragment
replace Fragment And To Back Stack
//package com.java2s; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; public class Main { public static void replaceFragmentAndToBackStack( final FragmentActivity activity, final int containerId, final Fragment fragment) { activity.getSupportFragmentManager().beginTransaction() .replace(containerId, fragment).addToBackStack(null) .commitAllowingStateLoss(); }/*from w w w . j a va2 s . co m*/ }