Elegant solution to retrieve custom date and time?
<p>I am currently using a date and time picker to retrieve a user-submitted date and time, and then I set a control's text to the date and time selected. </p>

<p>I am using the following code:</p>

<pre><code>new DatePickerDialog(newlog3.this, d, calDT.get(Calendar.YEAR), calDT.get(Calendar.MONTH), calDT.get(Calendar.DAY_OF_MONTH)).show();

new TimePickerDialog(newlog3.this, t, calDT.get(Calendar.HOUR_OF_DAY), calDT.get(Calendar.MINUTE), true).show();

optCustom.setText(fmtDT.format(calDT.getTime())); 
</code></pre>

<p>Now, while the above code block does bring up the date and time widgets and sets the text, the code block is being executed in full before the user can select the date.. ie: It brings up the date box first, then the time box over that, and then updates the text, all without any user interaction. I would like the date widget to wait to execute the time selector until the date selection is done, and i would like the settext to execute only after the time widget is done. </p>

<p>How is this possible? Or is there is a more elegant solution that is escaping me?</p>

<p>Edit: This is the code for DatePickerDialog/TimePickerDialog which is located within the class:</p>

<pre><code> DatePickerDialog.OnDateSetListener d=new DatePickerDialog.OnDateSetListener() { 
        public void onDateSet(DatePicker view, int year, int monthOfYear, 
                    int dayOfMonth) { 
            calDT.set(Calendar.YEAR, year); 
            calDT.set(Calendar.MONTH, monthOfYear); 
            calDT.set(Calendar.DAY_OF_MONTH, dayOfMonth); 
          //updateLabel(); 
        } 
      };   
 TimePickerDialog.OnTimeSetListener t=new TimePickerDialog.OnTimeSetListener() { 
        public void onTimeSet(TimePicker view, int hourOfDay, 
                             int minute) { 
            calDT.set(Calendar.HOUR_OF_DAY, hourOfDay); 
            calDT.set(Calendar.MINUTE, minute); 
          //updateLabel(); 
        } 
      };  
</code></pre>

<p>Thanks in advance</p>
