Code example for DialogFragment

Methods: show

0
ft.addToBackStack(null);
 
        // Create and show the dialog. 
        dialogFragment.show(ft, fragmentTag);
    } 
 
    public static void showDialog(@Nonnull android.support.v4.app.DialogFragment dialogFragment,
                                  @Nonnull String fragmentTag,
                                  @Nonnull android.support.v4.app.FragmentManager fm) {
        final android.support.v4.app.FragmentTransaction ft = fm.beginTransaction();
 
        android.support.v4.app.Fragment prev = fm.findFragmentByTag(fragmentTag);
        if (prev != null) {
            ft.remove(prev);
        } 
        ft.addToBackStack(null);
 
        // Create and show the dialog. 
        dialogFragment.show(ft, fragmentTag);
    }