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