If you call TimePickerDialog from java, you will be in clock mode, so I would like to know how to call it in spinner mode.
Calendar calendar=Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int minute = calendar.get (Calendar.MINUTE);
TimePickerDialog timeDialog = new TimePickerDialog(this,
newTimePickerDialog.OnTimeSetListener(){
@ Override
public void onTimeSet(TimePicker timePicker, inth, intm) {
String time = String.format ("%02d hour %02d minute", h, m);
TextView end= (TextView) findViewById (R.id.endTime);
end.setText(time);
}
}, hour, minute, true);
timeDialog.show();
TimePickerDialog timeDialog = newTimePickerDialog(this,
AlertDialog.THEME_HOLO_LIGHT,
newTimePickerDialog.OnTimeSetListener(){
@ Override
public void onTimeSet(TimePicker timePicker, inth, intm) {
String time = String.format ("%02d hour %02d minute", h, m);
TextView end= (TextView) findViewById (R.id.endTime);
end.setText(time);
}
}, hour, minute, true);
timeDialog.show();
If you set the HOLO theme for the second constructor argument like this, you will become a spinner.I think it's deprecated because it's old.
© 2024 OneMinuteCode. All rights reserved.