Monthly Archives: August 2012

TimePickerDialog and AM/PM vs 24 Hour format

Just a short article to maybe help other people not spend 1 hour searching the web for the answer like I did.

The Android SDK provides you with 2 really well made dialog pickers for respectively a date and a time : DatePickerDialog and TimePickerDialog.

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));

The method is24HourFormat from DateFormat allows us to retrieve the user setting.

Android + LEGO = Win ?

Update 08/07/2012 : After 24 hours, the project has already reached 2600+. 1/4 of the task is already done ! Now we just need to continue to talk about it so we reached rapidly the 10 000 mark ! :D

For the past years, I have been a developer as well as a huge fan of Android. I also have always played with LEGO (when I was young and even still now)

What if we could combine these 2 worlds ?!

That’s what Marc Young must have been thinking when he started his project !

This project looks awesome with even rotating arms, heads and antennas. And frankly I want one for myself ! :D

There is only one problem… This project is part of the CUUSOO system which is a way for people to present project to LEGO for future creation.
And before an idea can be valid, it needs to receive 10 000 votes.

So it would be great if you could vote for this project (it’s really fast and easy to do).

Page optimized by WP Minify WordPress Plugin