Code example for DialogFragment

Methods: getDialogonDestroyView, getRetainInstance

0
 
	// This is to work around what is apparently a bug. If you don't have it 
	// here the dialog will be dismissed on rotation, so tell it not to dismiss. 
	@Override 
	public void onDestroyView() { 
		if (getDialog() != null && getRetainInstance()) {
			getDialog().setDismissMessage(null);
		} 
		 
		super.onDestroyView(); 
	} 
 
	// Also when we are dismissed we need to cancel the task. 
	@Override 
	public void onDismiss(DialogInterface dialog) {
		super.onDismiss(dialog);
		 
		if (mTask != null) {
			mTask.cancel(false);
			 
Contextual code suggestions in your IDE  Get Codota for Java