4

How can I set Minimum time in timepicker (I am not using TimePickerDialog). I have searched a lot but unable to find the correct answer. I am using TimePicker to get time from user. This is my xml Code

               <TimePicker
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:headerBackground="@color/colorPrimary"
                    android:id="@+id/timePicker" />

This is how I get in my code

TimePicker timePicker = (TimePicker) findViewById(R.id.timePicker);

Now how can I set minimum time to bound user not to select past time.

This is how my timepicker look like....I am not using TimePickerDialog because I have to show different stuff with time as we well. Thanks!

enter image description here

Zohab Ali
  • 8,426
  • 4
  • 55
  • 63

0 Answers0