Apr 25, 2011

TimePickerDialog - how to set 24 hour view, or AM/PM.

TimePickerDialog is a dialog that prompts the user for the time of day using a TimePicker. Refer the post "TimePickerDialog" for working example.

TimePicker - how to set 24 hour view, or AM/PM.

TimePickerDialog provide two Constructors:

TimePickerDialog(Context context, TimePickerDialog.OnTimeSetListener callBack, int hourOfDay, int minute, boolean is24HourView)

TimePickerDialog(Context context, int theme, TimePickerDialog.OnTimeSetListener callBack, int hourOfDay, int minute, boolean is24HourView)


In both version of the Constructors, the last parameter, boolean is24HourView, define whether this is a 24 hour view, or AM/PM.

To select 24 hour view, set it true.
To select AM/PM view, set it false.


No comments:

Post a Comment

Infolinks In Text Ads