@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    Bundle extras = CommonActivity.getIntentExtras(data);
    if (extras != null) {

      // check for repeat update
      if (ActivityAppointmentRepeat.GetActivityResult(requestCode, resultCode, extras)) {
        iRepeatType = ActivityAppointmentRepeat.getExtraRepeatType(extras);
        iRepeatEvery = ActivityAppointmentRepeat.getExtraRepeatEvery(extras);
        dateEndOn.setTimeInMillis(ActivityAppointmentRepeat.getExtraRepeatEndOnDate(extras));
        UpdateRepeatInfo();
        return;
      }

      // check for date widget edit request code
      if (requestCode == DateWidget.SELECT_DATE_REQUEST) {
        final long lDate =
            DateWidget.GetSelectedDateOnActivityResult(requestCode, resultCode, extras, dateStart);
        if (lDate != -1) {
          UpdateStartDateTimeView();
          return;
        }
      }

      // check for time widget edit request code
      if ((requestCode == TimeWidget.SELECT_TIME_REQUEST) && (resultCode == RESULT_OK)) {
        final int iHour =
            TimeWidget.GetSelectedTimeHourOnActivityResult(requestCode, resultCode, extras);
        final int iMinute =
            TimeWidget.GetSelectedTimeMinuteOnActivityResult(requestCode, resultCode, extras);
        dateStart.set(Calendar.HOUR_OF_DAY, iHour);
        dateStart.set(Calendar.MINUTE, iMinute);
        chkAllDay.setChecked(false);
        UpdateStartDateTimeView();
        return;
      }

      // get KeyboardWidget result
      if ((requestCode == KeyboardWidget.EDIT_TEXT_REQUEST) && (resultCode == RESULT_OK)) {
        String sText = KeyboardWidget.GetTextOnActivityResult(requestCode, resultCode, extras);
        edSubject.setText(sText);
        return;
      }
    }
  }
 @Override
 protected void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   // save controls state
   outState.putString("subject", edSubject.getText().toString());
   outState.putBoolean("alarm", chkAlarm.isChecked());
   outState.putLong("dateStart", dateStart.getTimeInMillis());
   outState.putBoolean("allday", chkAllDay.isChecked());
   outState.putInt("repeatType", iRepeatType);
   outState.putInt("repeatEvery", iRepeatEvery);
   outState.putLong("dateEndOn", dateEndOn.getTimeInMillis());
 }
 @Override
 public boolean DateValuesChanged(Bundle data) {
   super.DateValuesChanged(data);
   if (GetStartMode() == StartMode.EDIT) {
     if (dateStart.getTimeInMillis() != data.getLong("dateStart")) return true;
   }
   return false;
 }
 @Override
 public void SaveDateValuesBeforeChange(Bundle data) {
   super.SaveDateValuesBeforeChange(data);
   if (GetStartMode() == StartMode.EDIT) {
     data.putLong("dateStart", dataRow.GetStartDate().getTimeInMillis());
     data.putLong("dateEndOn", dataRow.GetRepeat().GetEndOnDate().getTimeInMillis());
   }
 }
  // methods
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.appointment);

    // initialize objects
    dataRow = new DataRowAppointment(userdb);
    dataTable = new DataTable(dataRow);

    // check startup mode and open data
    if (GetStartMode() == StartMode.EDIT) if (!OpenDataForEdit(dataTable)) finish();

    // initialize views
    InitViews();
    InitState();
  }
 @Override
 public void onPause() {
   super.onPause();
 }
 @Override
 public void onResume() {
   super.onResume();
 }
 @Override
 public void onStart() {
   super.onStart();
 }