Getting Values from DatePicker and TimePicker
<p>I have 2 datepickers and 2 timepickers on a screen and also a submit button. The user selects the start date, start time, end date, and end time. The program then takes these values and stores them into variables, however the variables only return the default values for these controls. Is there anyway to get the updated value from each of these controls? </p>

<p>My code looks like this for the edit screen:</p>

<pre><code>public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.editscreen);

    timepickerStart = (TimePicker)findViewById(R.id.timePicker1);
    timepickerEnd = (TimePicker)findViewById(R.id.timePicker2);
    datepickerStart = (DatePicker)findViewById(R.id.datePicker1);
    datepickerEnd = (DatePicker)findViewById(R.id.datePicker2);

    submitbutton = (Button)findViewById(R.id.submit);

    locationText = (EditText)findViewById(R.id.locationText);
    eventText = (EditText)findViewById(R.id.eventText);

}

public void DateStart(View v)
{
    GlobalVariables.datepickerYearStart = datepickerStart.getYear();
    GlobalVariables.datepickerMonthStart = datepickerStart.getMonth();
    GlobalVariables.datepickerDayStart = datepickerStart.getDayOfMonth();
}

public void DateEnd(View v)
{
    GlobalVariables.datepickerYearEnd = datepickerEnd.getYear();
    GlobalVariables.datepickerMonthEnd = datepickerEnd.getMonth();
    GlobalVariables.datepickerDayEnd = datepickerEnd.getDayOfMonth();
}

public void TimeStart(View v)
{
    GlobalVariables.timepickerHourStart = timepickerStart.getCurrentHour();
    GlobalVariables.timepickerMinuteStart = timepickerStart.getCurrentMinute();
}

public void TimeEnd(View v)
{
    GlobalVariables.timepickerHourEnd = timepickerEnd.getCurrentHour();
    GlobalVariables.timepickerMinuteEnd = timepickerEnd.getCurrentMinute();
}

public void submitClicked(View v)
{

    startActivity(new Intent(this, AddToCalendar.class));
}
</code></pre>
