Code example for DialogFragment

Methods: dismiss, onResume

				getTargetFragment().onActivityResult(TASK_FRAGMENT, Activity.RESULT_CANCELED, null);
		public void onResume() { 
			// This is a little hacky, but we will see if the task has finished while we weren't 
			// in this activity, and then we can dismiss ourselves. 
			if (mTask == null)
		// This is called by the AsyncTask. 
		public void updateProgress(int percent) {
		// 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.