@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());
 }
  public void SaveData() {
    // check date if no repeat
    if ((iRepeatType == 0) && (DateBeforeNow(dateStart))) return;

    dataRow.SetSubject(edSubject.getText().toString());
    dataRow.SetStartDate(dateStart);
    dataRow.SetAllDay(chkAllDay.isChecked());
    dataRow.SetAlarm(chkAlarm.isChecked());

    // set repeat type
    RepeatData rd = dataRow.GetRepeat();
    rd.SetRepeatTypeAsInt(iRepeatType);
    rd.SetEvery(iRepeatEvery);
    rd.SetEndOnDate(dateEndOn.getTimeInMillis());

    if (SaveDataToTable(dataTable)) CloseActivity(dataTable);
  }
 private void UpdateStartDateTimeView() {
   btnStartDate.setText(AnCalDateUtils.formatMediumDate(this, dateStart));
   if (chkAllDay.isChecked()) {
     btnStartTime.setText(utils.GetResStr(R.string.labNoTime));
   } else {
     btnStartTime.setText(AnCalDateUtils.formatTime(this, dateStart));
   }
 }