2

I'm looking to create something EXACTLY like TimePickerDialog (look and feel) in Android, but it would be for MINUTES/SECONDS, not HOURS/MINUTES. Therefore AM/PM would not be relevant and would therefore allow MINUTE to be greater than 24 (making the max 59).

Is it possible to change the TimePickerDialog instance in any way to reflect this?

Any and all suggestions would be greatly appreciated. :-)

Fran Fitzpatrick
  • 17,902
  • 15
  • 33
  • 34

3 Answers3

7

Is it possible to change the TimePickerDialog instance in any way to reflect this?

No, but the layout and source code to TimePickerDialog are both available as a starting point for implementing your own dialog.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Great; this helped a lot! I landed up implementing my own NumberPicker which I got from TimePickerDialog. :-) – Fran Fitzpatrick Sep 07 '10 at 15:17
  • Honestly, I didn't even know where to find this, so thank you for the link! – onaclov2000 Feb 18 '11 at 13:18
  • I keep getting...This webpage is not available The connection to android.git.kernel.org was interrupted...any ideas why? – easycheese Sep 04 '11 at 05:59
  • 1
    @easycheese: http://stackoverflow.com/questions/7294796/access-denied-to-android-git-kernel-org/7295506#7295506 – CommonsWare Sep 04 '11 at 10:26
  • 1
    Links have changed: [layouts](https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/layout/) and [sources](https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/app), I'm only giving the directory because there are multiple files of interest. – RedGlyph Aug 03 '21 at 09:13
1

This might help:

TimePicker with seconds:

https://github.com/IvanKovac/TimePickerWithSeconds

Have a look.

enter image description here

Majstor
  • 859
  • 1
  • 12
  • 22
1

As the links in CommonsWare's answer are now dead, you might want to know that the source for TimePickerDialog is probably already on your local machine - it is included in the SDK. Try looking in the following locations:

[SDK_HOME]/sources/android-23/android/app/TimePickerDialog.java
or
[SDK_HOME]/sources/android-23/com/android/datetimepicker/time/TimePickerDialog.java


[SDK_HOME]/platforms/android-23/data/res/layout/time_picker_dialog.xml

Of course, choose the Android version that you want to borrow from. References to R. should be to android.R. Unfortunately, there seem to be some visibility issues with ValidationCallback - even on recent SDK levels.

Community
  • 1
  • 1
Tad
  • 4,668
  • 34
  • 35