Code example for DialogFragment

Methods: getActivity, getArguments, getString

0
			return create(R.string.signingToGooglePlus); 
		} 
		 
		@Override 
		public Dialog onCreateDialog(Bundle savedInstanceState) {
			ProgressDialog progressDialog = new ProgressDialog(getActivity());
			progressDialog.setIndeterminate(true);
			progressDialog.setMessage(getString(getArguments().getInt(ARG_MESSAGE)));
			return progressDialog;
		} 
		 
		@Override 
		public void onCancel(DialogInterface dialog) {
			super.onCancel(dialog);
			FragmentActivity activity = getActivity();
			if (activity == null) {
				return; 
			} 
			 
			Fragment fragment = activity.getSupportFragmentManager().findFragmentByTag(TAG_PLUS_CLIENT);
			if (fragment instanceof PlusClientFragment) {