Code example for FragmentManager

Methods: beginTransaction, findFragmentByTag

0
public class Utils { 
 
    public static void showAbout(ActionBarActivity 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");
    } 
 
    /** 
     * About Dialog 
     */ 
    public static class AboutDialog extends DialogFragment {
 
        private static final String VERSION_UNAVAILABLE = "N/A";