Java tutorial
//package com.java2s; //License from project: Apache License import android.app.Fragment; import android.app.FragmentManager; import android.app.FragmentTransaction; public class Main { public static void addFragmentToLayout(final int containerId, final FragmentManager fragmentManager, final Fragment fragment, final String tag) { final FragmentTransaction ft = fragmentManager.beginTransaction(); ft.add(containerId, fragment, tag); ft.commit(); } }