Redeem Now
Read More
Read now

how we can use DatePickerDialog in android


In this blog we will read how we can use DatePickerDialog in android . DatePikcerDialog in android allows user to select date . DatePickerDialog allows user to select day,month and year in our application.


In xml file we will use a button and a Textview . when user click on button he will see a Dialog and he can select date from that dialog. Which date user select will be visible in text view and you can see complete code for activity_main.

DatePickerDialog select date from instance of Calendar so we use get Instance method. check below code and  See how can we get instance of Calendar.

If you want to set  date so use  OnDateSetListener() interface .check and see below to set date from date picker dialog.

Initialize date picker dialog and send needed parameter .



In MainActivity you can we use a click listener when you click on button it will show a dialog and here you can select date.

You can change background color and button colors. In style you can provide negative button and positive button .


And here you can check screenshot of date Picker how it will show


So here we discussed about how we can use DatePickerDialog in android  .  Thanks for reading this blog and You can get other blogs from here


. . .


Add Your Comment

Be the first to comment.

Hire Us!
Brief us about your requirements and we'll get back to you.
Woo! Hooy!
We have just recieved your project brief and our expert will contact you shortly.
Send Again