How to create date picker in Android Studio #16 || Android App Development Tutorials 2020

Опубликовано: 01 Октябрь 2024
на канале: Syed Ali Raza
53
4

In Android, DatePicker is a widget used to select a date. It allows to select date by day, month and year in your custom UI (user interface). If we need to show this view as a dialog then we have to use a DatePickerDialog class. For selecting time Android also provides timepicker to select time.
Methods of DatePicker

Let’s discuss some common methods of a datepicker which are used to configure a DatePicker in our application.
1. setSpinnersShown(boolean shown):
This method is used to set whether the spinner of the date picker in shown or not. In this method you have to set a Boolean value either true or false. True indicates spinner is shown, false value indicates spinner is not shown. Default value for this function is true.
Below we show the use of setSpinnerShown() function by setting false value.
2. getDayOfMonth():
This method is used to get the selected day of the month from a date picker.  This method returns an integer value.
Below we get the selected day of the month from a date picker.
3. getMonth():
This method is used to get the selected month from a date picker.  This method returns an integer value.
Below we get the selected month from a date picker.
4. getYear():
This method is used to get the selected year from a date picker.  This method returns an integer value.
Below code is used to get the selected year from a date picker.
5. getFirstDayOfWeek():
This method is used to get the first day of the week. This method returns an integer value.
Below code is used to get the first day of the week.

👩‍💻👨‍💻Android Course
1. Text View
2. Button
3. Edit Text
4. Radio Button & Radio group
5. Check box
6. Switch
7. Toggle Button
8. Rating Bar
9. Seek Bar
10. Progress Bar
11. Spinner
12. Time picker
13. Date Picker
14. Simple and Custom Toast
15. Alert Dialog
Menu Bars
1. Action Bar
2. Option Menu
3. Context Menu
4. Popup Menu
Intents
1. Explicit intents
2. Implicit Intents
3. Share
4. Call
5. Message
Advanced
1. Splash Screen
2. List View
3. Grid View
4. Tab View
5. Video View
6. Audio View
7. Image slider
8. Send SMS
9. Send Email
10. Send Call
11. Blue Tooth
12. Map Navigation
13. Text Switcher
14. Image Switcher
15. Stack View
16. Bottom Sheet
17. Navigation Drawer
18. Notification
19. Tab View
20. Sql Lite Database
Ecommerce App Project
#xml file,
design layout designing,
#E-commerce Application development
#Cooking application designing
#poetry Application development
#university Management App

Android app development full course:
   • Introduction to android app developme...  

Freelancing complete course:
   • Create first gig on Fiverr part1 || F...  

Flutter Mobile app development course:
   • Flutter introduction for Mobile devel...  

👩‍💻Android Apps with source code:
   • eCommerce   App development With sour...