If you not understand this lecture Creating  a time in android.You should also read my previous lectures. Toggle button in android studio and Button and its click events in android . After reading these lecture you will also able to create Time Picker of your app.


Time Picker allows the user to select a time value from a list of predefined values or to enter a new one.It displays scrollable lists of hours and minutes and offers the user experience of high performance and good looking interface.which allows the user to select the hour and minute in a familiar interface.


In this lecture we will describe how can create Time Picker in android.We will also describe Time Picker and its description.what is Time Picker. why we can use it.After Reading this lecture you will understand Time Picker in android And i hope you will create Time Picker of your application.

Description of  android Time Picker

In this Lecture we describe how can create  android time picker using Dialog Fragment.Dialog Fragment is available in android version 3.0.if your application SDK below 3.0 then you will use other supporting libraries and if you will use android SDK 3.0 then you will not use any supporting libraries.So we will create  a application that will describe how can create a android time picker using Dialog Fragment. For more detail about  android time picker click on Time Picker in android .First of all you will create a new project in android studio.  Every project contain two file first is java class file and second is layout XML.So you will open your SDK manager and find out extra folder and expand the extra folder. In this folder you can see android supporting library.  So  you can installed android support repository.Now you  will add supporting can add supporting library detail is provides step by step.

Step 1=Add library<-And Click on Gradel Script-><-Open  built.gradle->And find out the section android dependencies and add supporting library.

You can also find out this library at android developer site.And change minSdkVersion 7 and targetSdkVersion18 and  click the option Syncnow . After that you will check the Gradel file sync successfully or not.

Open a Gradle built change your code according to this code.

Now we creating time picker in android.we need to create new class how can create a class step by step detail is provide.that are show in below pic.

Step2=Create  DialogHandler class ->Right click-> the ->package name ->select ->New option-> and click-> java class that will show in below.  

Alt Tag Android make new class


Alt Tag android dailog handler class

Write the code in DialogHandler class

For handling the click event we create other java class.that we handle the click events.

Step4 = -<Create TimeSetting class ->Right click-> the ->package name ->select ->New option-> and click-> java class that will show in below.  

Alt Tag Android make new class


Alt Tag android time setting

Write the code in TimeSetting class

In this example we are going to create a simple UI that includes only (Time Picker in android ) with Different attributes.And paste the following code Time Picker in android into layout .XML file.

Now you may open the Graphical layout editor to preview the User Interface you created of Time Picker  in android.

Alt Tag android time picker dialog

Code that are write in java class file of Time picker in android

Run the application of  Time Picker in android

Alt Tag android time picker output image

Thank you  for reading this lecture Hope you got the idea.