Android DatePicker

Categories: Android // Tags: , .

// By:Team // 1 comment

Email this to someonePrint this pageShare on Google+1Share on Facebook0Tweet about this on TwitterShare on LinkedIn1Share on Reddit0Pin on Pinterest0Share on StumbleUpon1
  • Android DatePicker is a widget to select date. It allows you to select date by day, month and year. Like DatePicker, android also provides TimePicker to select time.
  • The android.widget.DatePicker is the subclass of FrameLayout class.
  • DatePicker object is also passed into this function. You can use the following methods of the DatePicker to perform further operation.
    Sr.No Method & description
    1 getDayOfMonth()This method gets the selected day of month
    2 getMonth()This method gets the selected month
    3 getYear()This method gets the selected year
    4 setMaxDate(long maxDate)This method sets the maximal date supported by this DatePicker in milliseconds since January 1, 1970 00:00:00 in getDefault() time zone
    5 setMinDate(long minDate)This method sets the minimal date supported by this NumberPicker in milliseconds since January 1, 1970 00:00:00 in getDefault() time zone
    6 setSpinnersShown(boolean shown)This method sets whether the spinners are shown
    7 updateDate(int year, int month, int dayOfMonth)This method updates the current date
    8 getCalendarView()This method returns calendar view
    9 getFirstDayOfWeek()This Method returns first day of the week

Android DatePicker Example

Now we are going to see the example that will help you for undarstand the android datepicker .

activity_main.xml

File: activity_main.xml

Activity class

File: MainActivity.java

Output:

android-datepicker

Email this to someonePrint this pageShare on Google+1Share on Facebook0Tweet about this on TwitterShare on LinkedIn1Share on Reddit0Pin on Pinterest0Share on StumbleUpon1

About Team

Browse Archived Articles by Team

Related

Sorry. There are no related articles at this time.