Java tutorial
//package com.java2s; import android.app.Fragment; import android.app.FragmentManager; import android.app.FragmentTransaction; public class Main { public static void addFragmentToActivity(FragmentManager fragmentManager, Fragment fragment, int frameId) { FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.add(frameId, fragment); transaction.commit(); } }