Code example for FragmentTransaction

Methods: addToBackStack, remove, show

0
    public static void showAbout(FragmentActivity activity) {
        FragmentManager fm = activity.getSupportFragmentManager();
        FragmentTransaction ft = fm.beginTransaction();
        Fragment prev = fm.findFragmentByTag("dialog_about");
        if (prev != null) {
            ft.remove(prev);
        } 
        ft.addToBackStack(null);
 
        new AboutDialog().show(ft, "dialog_about");
    } 
 
    public static class AboutDialog extends DialogFragment {
 
        private static final String VERSION_UNAVAILABLE = "N/A";
 
        public AboutDialog() { 
        } 
 
        @Override 
        public Dialog onCreateDialog(Bundle savedInstanceState) {