Android examples for User Interface:Fragment
go To Next Fragment
//package com.java2s; import android.app.Activity; import android.app.Fragment; import android.app.FragmentTransaction; public class Main { public static void goToNextFragment(Fragment fragment, int container, boolean addToBackStack, Activity ctx, String tag) { // Create new fragment and transaction FragmentTransaction transaction = ctx.getFragmentManager() .beginTransaction();/*w w w. jav a2s. c o m*/ // Replace whatever is in the fragment_container view with this fragment, // and add the transaction to the back stack transaction.replace(container, fragment, tag); if (addToBackStack) transaction.addToBackStack(tag); // Commit the transaction transaction.commit(); } }