Code example for DialogFragment

Methods: getActivity, getString

0
		this.dialogTitleArgs = dialogTitleArgs;
	} 
	 
	@Override 
	public Dialog onCreateDialog(Bundle savedInstanceState) {
		return new AlertDialog.Builder(getActivity())
			.setIcon(android.R.drawable.ic_dialog_alert)
			.setTitle(getString(dialogTitle, dialogTitleArgs))
			.setPositiveButton(android.R.string.yes, new OnClickListener() {
				@Override 
				public void onClick(DialogInterface dialog, int which) {
					resultListener.onConfirmed();
				} 
			}) 
			.setNegativeButton(android.R.string.no, null)
			.create();
	} 
	 
	public interface OnDialogResult { 
		public void onConfirmed(); 
	}