Code example for DialogFragment

Methods: dismiss, getTargetFragment, isResumed

		// This is also called by the AsyncTask. 
		public void taskFinished() { 
			// Make sure we check if it is resumed because we will crash if trying to dismiss the dialog 
			// after the user has switched to another app. 
			if (isResumed())
			// If we aren't resumed, setting the task to null will allow us to dimiss ourselves in 
			// onResume(). 
			mTask = null;
			// Tell the fragment that we are done. 
			if (getTargetFragment() != null)
				getTargetFragment().onActivityResult(TASK_FRAGMENT, Activity.RESULT_OK, null);
	// This is a fairly standard AsyncTask that does some dummy work. 
	public static class MyTask extends AsyncTask<Void, Void, Void> {