Prerequisite

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

Overview

Date Picker which allows the user to select the month, day and year in a familiar interface.It is similar to the spinner user can select a option like year and month.It displays scrollable lists of month , year and days offers the user experience of high performance and good looking interface.which allows the user to select the year and month and days in a familiar interface.

Introduction

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

Description of android Date Picker

In this Lecture we describe how can create  android Date 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 Date picker using Dialog Fragment. For more detail about Date picker in android click on Date 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 library.how 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

Step3=Step2->WriteName->Ok

Alt Tag android dailog handler class

Write  code in DialogHandler class

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

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

Alt Tag Android make new class

Step5=Step4->WriteName->Ok

Alt Tag android Date setting

Write the code in DateSetting class

In this example we are going to create a simple UI that includes only (Date Picker in android ) with Different attributes.And paste the following code Date 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 date set image

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

Run the application of  Date Picker in android

Alt Tag android output image of date setting

 

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