How to highlight multiple dates in a android CalendarView programmatically
18,480
Follow this link to get the library mCalendarView
-
Use 3rd party library McalenderView.
-
Add to your gradle:
sun.bob:mcalendarview:1.0.0
Try this code:
- Some code:
calendarView = ((MCalendarView) view.findViewById(R.id.calendar_exp));
ArrayList<DateData> dates=new ArrayList<>();
dates.add(new DateData(2018,04,26));
dates.add(new DateData(2018,04,27));
for(int i=0;i<dates.size();i++) {
//mark multiple dates with this code.
calendarView.markDate(dates.get(i).getYear(),dates.get(i).getMonth(),dates.get(i).getDay());
}
Log.d("marked dates:-","" + calendarView.getMarkedDates()); //get all marked dates.
![Kavin-K](https://lh3.googleusercontent.com/-cy9YtT0rJag/AAAAAAAAAAI/AAAAAAAAAEs/7pYXIfIZiI8/photo.jpg?sz=256)
Author by
Kavin-K
I am a highly competent mobile application developer with 4+ years of experience developing a wide range of applications in iOS and Android for a range of clients. I have proven expertise in building eCommerce apps. I am enthusiastic, committed to professional growth, work well under stress, and can meet deadlines. I am also self-motivated, a team player, and can think on my feet, able to adapt and change as situation warrants.
Updated on July 25, 2022