我设置了一个 onCreateDialog,我需要放置 2 个对话框(Datepicker 和 Timepicker),但是当我将它们都放在 onCreateDialog 中时,它只会打开第一个是 Datepicker。
代码:
@Override
protected Dialog onCreateDialog(int id) {
//date picker
switch (id) {
case DATE_DIALOG_ID:
// set date picker as current date
return new DatePickerDialog(this, datePickerListener, year, month,day);
}
//time picker
switch (id) {
case TIME_DIALOG_ID:
//set time picker as current time
return new TimePickerDialog(this, timePickerListener, hour, minute,false);
}
return null;
}