I'm using the following code to display a TimePickerDialog
:
TimePickerDialog dialog = new TimePickerDialog(this, new OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
System.out.println("onTimeSet");
}
}, 20, 15, true);
dialog.setTitle("Test");
dialog.setButton(TimePickerDialog.BUTTON_POSITIVE, "Done", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
System.out.println("Done");
}
});
dialog.setButton(TimePickerDialog.BUTTON_NEGATIVE, "Cancel", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
System.out.println("Cancel");
}
});
dialog.show();
On a device running Android 2.3.7, the onTimeSet
method doesn't get called (the onClick
methods do). On a device running 4.2.2 the onTimeSet
does get called like it should.
What is happening here?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…