Java tutorial
//package com.java2s; import android.app.Activity; import android.app.Fragment; import android.app.FragmentTransaction; public class Main { public static void addFragment(Activity activity, int containerViewId, Fragment fragment, String fragmentTag) { activity.getFragmentManager().beginTransaction().setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN) .add(containerViewId, fragment, fragmentTag).disallowAddToBackStack().commit(); } }