Code example for DialogFragment

0
        Dialog dialog = ShadowDialog.getLatestDialog();
        assertFalse(dialog.isShowing());
        assertTrue(shadowOf(dialog).hasBeenDismissed());
    } 
     
    private class TestDialogFragment extends DialogFragment {
        final Transcript transcript = new Transcript();
        Activity onAttachActivity;
        private Dialog returnThisDialogFromOnCreateDialog;
 
        @Override 
        public void onAttach(Activity activity) {
            transcript.add("onAttach");
            onAttachActivity = activity;
            super.onAttach(activity);
        } 
 
        @Override 
        public void onCreate(Bundle savedInstanceState) {
            transcript.add("onCreate");