Code example for DialogFragment

Methods: onDismiss, getTargetFragment

0
	} 
 
	// 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);
			 
			Fragment target = getTargetFragment();
			if (target != null) {
				if (!(target instanceof Callbacks)) {
					throw new IllegalStateException("DetectorTaskFragment target must implement its callbacks");
				} 
				 
				((Callbacks)target).onTaskCancelled();
			} 
		}		 
	}