我使用标准的android timepicker:
...
showDialog(TIMEPICKER);
...
private TimePickerDialog.OnTimeSetListener mTimeSetListener =
new TimePickerDialog.OnTimeSetListener() {
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
//code;
}
};
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case TIMEPICKER:
return new TimePickerDialog(this,mTimeSetListener, 0, 0, true);
}
return null;
}
一切都很好,但是我怎样才能抓住取消按钮来执行一些代码?