Code example for DialogFragment

Methods: getDialogonDestroyView, getRetainInstance

0
	 
	// By default, the app will crash if the 
	// hosting activity is destroyed while the dialogfragment is displayed i.e: during screen reotation 
	@Override 
	public void onDestroyView() { 
	  if (getDialog() != null && getRetainInstance())
	    getDialog().setOnDismissListener(null);
	  super.onDestroyView(); 
	} 
} 
Connect your IDE to all the code out there  Get Codota for Java