How to Hide or Disable Minutes widget in Android TimePickerDialog?

I'm working on an application where i want to give user the ability of just to select Hours and AM/PM but Minutes widget should be fixed as i mentioned. I am using TimePickerDialog. Is there any possibility of doing that?

Upvotes: 1

Views: 3068

Answers (2)

Uttam
Uttam

Reputation: 12399

I am not sure but you can use Android wheel with Timepicker.

http://code.google.com/p/android-wheel/source/browse/trunk/wheel/src/kankan/wheel/demo/TimeActivity.java?r=16

and also check out this link:

http://code.google.com/p/android-wheel/

Upvotes: 2

Pointer Null
Pointer Null

Reputation: 40380

There's no direct way. TimePickerDialog doesn't even give you TimePicker that it's using. So you'd have to copy code from TimePickerDialog.java to suit your own needs.

Another part is that TimePicker doesn't give you access to its sub-views (id's are not public), so you'd also need to copy time_picker.xml from Android sources, and create your own TimePicker view.

Good news is that you can copy from Android source code, and both mentioned sources are rather short, so it's relatively easy task to make this work.

Upvotes: 0

Related Questions