Code example for DialogFragment

Methods: dismiss, onResume

0
				getTargetFragment().onActivityResult(TASK_FRAGMENT, Activity.RESULT_CANCELED, null);
		} 
 
		@Override 
		public void onResume() { 
			super.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)
				dismiss();
		} 
 
		// This is called by the AsyncTask. 
		public void updateProgress(int percent) {
			mProgressBar.setProgress(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 
Contextual code suggestions in your IDE  Get Codota for Java