Code example for DialogFragment

Methods: getDialog, setCancelable, show

0
        assertTrue(shadowOf(dialog).isCancelable());
    } 
 
    @Test 
    public void shouldSetNotCancelableOnDialogBeforeShow() throws Exception { 
        DialogFragment dialogFragment = new DialogFragment();
        dialogFragment.setCancelable(false);
        dialogFragment.show(fragmentManager, "TAG");
 
        Dialog dialog = dialogFragment.getDialog();
 
        assertFalse(shadowOf(dialog).isCancelable());
    } 
 
    @Test 
    public void shouldSetNotCancelableOnDialogAfterShow() throws Exception { 
        DialogFragment dialogFragment = new DialogFragment();
        dialogFragment.show(fragmentManager, "TAG");
        dialogFragment.setCancelable(false);
 
        Dialog dialog = dialogFragment.getDialog();