Esempio n. 1
0
  public void onDateSet(DatePicker view, int year, int month, int day) {

    // String dates = date.getText().toString();

    GregorianCalendar GC =
        new GregorianCalendar(view.getYear(), view.getMonth(), view.getDayOfMonth());

    String newDate =
        GC.getDisplayName(GregorianCalendar.DAY_OF_WEEK, GregorianCalendar.SHORT, Locale.UK)
            + " "
            + GC.get(GregorianCalendar.DAY_OF_MONTH)
            + " "
            + GC.getDisplayName(GregorianCalendar.MONTH, GregorianCalendar.SHORT, Locale.UK);

    if (this.button.getId() == R.id.get_check_in) {
      TextView date1 = (TextView) getActivity().findViewById(R.id.startDate1);
      TextView date2 = (TextView) getActivity().findViewById(R.id.startDate2);
      String S1 = newDate;
      String S2 = Integer.toString(GC.get(GregorianCalendar.YEAR));
      date1.setText(S1);
      date2.setText(S2);
    }
    if (this.button.getId() == R.id.get_check_out) {
      TextView date1 = (TextView) getActivity().findViewById(R.id.endDate1);
      TextView date2 = (TextView) getActivity().findViewById(R.id.endDate2);
      String S1 = newDate;
      String S2 = Integer.toString(GC.get(GregorianCalendar.YEAR));
      date1.setText(S1);
      date2.setText(S2);
    }
  }
 private void monthChanged() {
   refreshCalendar();
   heading.setText(
       calendar.getDisplayName(GregorianCalendar.MONTH, GregorianCalendar.LONG, Locale.ENGLISH)
           + " "
           + calendar.get(GregorianCalendar.YEAR));
 }