Code example for DialogFragment

Methods: getActivity, getTargetFragment

0
	private class RecursiveDeleteTask extends AsyncTask<Void, Void, Void> {
		private Context mContext;
		 
		public RecursiveDeleteTask() { 
			// Init before having the fragment in an undefined state because of dialog dismissal 
			mContext = getTargetFragment().getActivity().getApplicationContext();
		} 
		 
		/** 
		 * If 0 some failed, if 1 all succeeded.  
		 */ 
		private int mResult = 1;
		private ProgressDialog dialog = new ProgressDialog(getActivity());
 
		/** 
		 * Recursively delete a file or directory and all of its children. 
		 *  
		 * @returns 0 if successful, error value otherwise. 
		 */ 
		private void recursiveDelete(File file) {
			File[] files = file.listFiles();