Code example for DialogFragment

Methods: dismiss, show

0
        assertSame(dialogFragment, fragmentManager.findFragmentByTag("this is a tag"));
    } 
 
    @Ignore("needs some work") @Test 
    public void dismiss_shouldDismissTheDialog() throws Exception { 
        dialogFragment.show(fragmentManager, "tag");
         
        dialogFragment.dismiss();
 
        Dialog dialog = ShadowDialog.getLatestDialog();
        assertFalse(dialog.isShowing());
        assertTrue(shadowOf(dialog).hasBeenDismissed());
         
        assertNull(fragmentManager.findFragmentByTag("tag"));
    } 
 
    @Test 
    public void removeUsingTransaction_shouldDismissTheDialog() throws Exception { 
        dialogFragment.show(fragmentManager, null);
 
        FragmentTransaction t = fragmentManager.beginTransaction();