Android CalendarView Tutorial with Example

By | June 7, 2019
CalendarView in Android Tutorial Example

CalendarView in Android

CalendarView is a display of calendar in Android. Calendar View widget is API level 11 added.It is use to display show calendar to to selection date.It can display Dates.Month And Year.It is customization to change month,day and year and selection to date.

CalendarView display current date,month and year.You can Select Any date,month and year of calendarView.

CalendarView Methods in Android

getDate() : This method is used to get the selected date of calendarView.

setDate(long date) : This method is used to set the selected date in milliseconds in calendarView.

 setFirstDayOfWeek(int firstDayOfWeek) : This method is used to set the first day of the week.

getFirstDayOfWeek() :  This method is used to get the first day of week. This method returns an int type value.

setMaxDate(long maxDate) : This method is used to set the maximal date supported by this CalendarView

 getMaxDate() : This method is used to get the maximal date supported by this CalendarView in milliseconds.

setMinDate(long minDate) : This method is used to to set the minimal date supported by this CalendarView in milliseconds.

CalendarView above the method is used this view. another more than method is available in calendarView to you can used.

Example of CalendarView in Android

Create activity_main.xml File And Follow this Code.

Create MainActivity.java File and Following this Code.

CalendarView in android Tutorial with Example

Above the Example of we have create calendarView tag and then create calendarView setListener. when you can select the date to display toast message date you want to selected.