Вопрос

I wanna display a Time Picker in my android app but when time picker displays it display current minute and hour but it can't set that it is AM or PM.

Snapshot of the code sample used to populate time Picker

return new TimePickerDialog(this, timeSetListener,
c.get(Calendar.HOUR), c.get(Calendar.MINUTE), false);

Sample of timepicker

In the above image snap of time picker which display irrespective of the current AM or PM. I want in time picker it should display that whether it is AM or PM.

Это было полезно?

Решение

Use:

Calendar.HOUR_OF_DAY

Instead of

Calendar.HOUR
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top