How can I create date and time settings dialog in Android? I want:
- 3 fields – day, hours and minutes
- it should look native to the system – that makes writing my own widget quite hard – how to make the plus/minus buttons above/below each field look like the standard buttons that are in TimePickerDialog? I mean even on HTC Sense.
Create buttons that you’ll use to both display the date and time, and trigger the date and time dialogs.
Example code :
Create your dialogs like this :
Your screen will look like this :
When clicking the date button, a datepicker will popup looking like this :
When clicking the time button, a timepicker will popup looking like this :
Android doesn’t offer a combined DateTimePicker dialog out of the box… If you want to combine both the date and timepicker on 1 screen or dialog you have 3 options :
Work with the UI widgets in a layout/view :
Find a third party component offering this functionality
There’s a custom datetimepicker at http://code.google.com/p/datetimepicker
Write one yourself