Android examples for User Interface:Fragment
add Fragment With History
//package com.java2s; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentTransaction; public class Main { public static void addFragmentWithHistory(Fragment fragment, FragmentActivity activity, int fragHolderLayout) { FragmentTransaction fragTransaction = activity .getSupportFragmentManager().beginTransaction(); fragTransaction.replace(fragHolderLayout, fragment); fragTransaction.addToBackStack(null); fragTransaction.commit();// ww w. ja v a2s. co m } }