sPFApp/src/main/java/it/polimi/spf/app/fragments/profile/ProfileFieldViewFactory.java
@SuppressWarnings("unchecked")
	private <E> View createDateView(final DateProfileField field, Date currentValue, final FieldValueListener<Date> listener, ViewGroup container) {
		View result = mInflater.inflate(R.layout.profileedit_field_date, container, false);
		String friendlyName = mHelper.getFriendlyNameOfField(field);
		((TextView) result.findViewById(R.id.profileedit_field_identifier)).setText(friendlyName);

		String dateToShow;
		if (currentValue == null) {
			dateToShow = "Click to edit";
		} else {
			dateToShow = mHelper.convertToFriendlyString(field, currentValue);
		}
		final TextView dateTextView = (TextView) result.findViewById(R.id.profileedit_field_date_text);
		dateTextView.setText(dateToShow);
		dateTextView.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				Calendar today = GregorianCalendar.getInstance();
				int year = today.get(Calendar.YEAR);
				int monthOfYear = today.get(Calendar.MONTH);
				int dayOfMonth = today.get(Calendar.DAY_OF_MONTH);
				OnDateSetListener callBack = new OnDateSetListener() {
					@Override
					public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
						GregorianCalendar cal = new GregorianCalendar(year, monthOfYear, dayOfMonth);
						Date newDate = new Date(cal.getTimeInMillis());
						String newDateString = mHelper.convertToFriendlyString(field, newDate);
						dateTextView.setText(newDateString);
						listener.onFieldValueChanged(field, newDate);
					}
				};
				DatePickerDialog dialog = new DatePickerDialog(mContext, callBack, year, monthOfYear, dayOfMonth);
				dialog.show();
			}
		});

		setUpCircleView(result, (ProfileField<E>) field, (FieldValueListener<E>) listener);

		return result;
	}
@SuppressWarnings("unchecked")
	private <E> View createDateView(final DateProfileField field, Date currentValue, final FieldValueListener<Date> listener, ViewGroup container) {
		View result = mInflater.inflate(R.layout.profileedit_field_date, container, false);
		String friendlyName = mHelper.getFriendlyNameOfField(field);
		((TextView) result.findViewById(R.id.profileedit_field_identifier)).setText(friendlyName);

		String dateToShow;
		if (currentValue == null) {
			dateToShow = "Click to edit";
		} else {
			dateToShow = mHelper.convertToFriendlyString(field, currentValue);
		}
		final TextView dateTextView = (TextView) result.findViewById(R.id.profileedit_field_date_text);
		dateTextView.setText(dateToShow);
		dateTextView.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				Calendar today = GregorianCalendar.getInstance();
				int year = today.get(Calendar.YEAR);
				int monthOfYear = today.get(Calendar.MONTH);
				int dayOfMonth = today.get(Calendar.DAY_OF_MONTH);
				OnDateSetListener callBack = new OnDateSetListener() {
					@Override
					public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
						GregorianCalendar cal = new GregorianCalendar(year, monthOfYear, dayOfMonth);
						Date newDate = new Date(cal.getTimeInMillis());
						String newDateString = mHelper.convertToFriendlyString(field, newDate);
						dateTextView.setText(newDateString);
						listener.onFieldValueChanged(field, newDate);
					}
				};
				DatePickerDialog dialog = new DatePickerDialog(mContext, callBack, year, monthOfYear, dayOfMonth);
				dialog.show();
			}
		});

		setUpCircleView(result, (ProfileField<E>) field, (FieldValueListener<E>) listener);

		return result;
	}
Edit view for date fields