Android examples for User Interface:Fragment
replace Default Fragment
//package com.java2s; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; public class Main { public static void replaceDefault(int toReplaceId, FragmentManager fm, Fragment showfragment) {// w ww. j a v a 2 s .c om FragmentTransaction ft = fm.beginTransaction(); ft.replace(toReplaceId, showfragment); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); ft.addToBackStack(null); ft.commit(); } }