Code example for DialogFragment

Methods: dismiss, getTargetFragment, isResumed

1
		// We'll get around this by setting mTask to null in that case - onResume will then call dismiss() 
		 
		// Setting mTask to null also ensures that we don't declare the task cancelled on dismiss 
		mTask = null;
				 
		if (isResumed()) {
			dismiss();
		} 
 
		// Tell the fragment that we are done. 
		Fragment target = getTargetFragment();
		if (target != null) {
			if (!(target instanceof Callbacks)) {
				throw new IllegalStateException("DetectorTaskFragment target must implement its callbacks");
			} 
			 
			((Callbacks)target).onTaskFinished(results);
		} 
	} 
}