Just a short article to maybe help other people not spend 1 hour searching the web for the answer like I did.
The constructors for
DatePickerDialog are pretty much straight-forward.
However the one for
TimePickerDialog has a small problem :
As you can see in the screenshot above, you need to specify through the
is24HourView parameter whether you want to display a time with hours from 0 to 23 (used in France and Germany for example) or you want to display a time with hours from 1 to 12 and also AM/PM selector (used in the USA for example).
The main problem is that I don’t want to choose that in my code. I want it to be linked to the user locale settings like everythink else.
I don’t want why it was coded like that but here is how to link this parameter to the user locale :
new TimePickerDialog(this, mOnTimeSetListener, time.hour, time.minute, DateFormat.is24HourFormat(this));
DateFormat allows us to retrieve the user setting.