Android examples for User Interface:Fragment
pop Fragment
import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; public class Main{ public static void popFragment(AppCompatActivity activity, Fragment fragment) {/* w ww .j a v a 2s. c om*/ FragmentManager manager = activity.getSupportFragmentManager(); FragmentTransaction trans = manager.beginTransaction(); trans.remove(fragment); trans.commit(); manager.popBackStack(); } }