Time picker in Android using kotlin:

Time picker:–

It is a widget in Android which is used to set time.
For example the start time and end time for your services, with the help of time picker you can do it easily.
Time picker comes with two modes one is clock mode and other is spinner mode.

Steps to create a time picker in Android using kotlin:–

Step 1:- Add a Time picker in your layout (XML File).
Step 2:- Set all the constraints for time picker.
Step 3:- Now go to Main Activity.kt and apply on listener on time picker like this:-

Starttime(id of time picker).setonTimechanged{timepicker,i,i2->
Toast.maketext(this@mainactivity,text”$i:$i2,
Toast length_long).(show)

Properties for Mode:
You can change the mode of time picker according to your requirement.

You can change the mode of time picker in (XML file):-
<Timepicker
Android: timepickermode=”spinner”

Finish

https://youtu.be/1KuPz2UIHaI

Leave a Reply

Your email address will not be published. Required fields are marked *