How To Highlight Multiple Dates In A Android Calendarview Programmatically
I need to highlight several dates in a CalendaView. that should look like, I tried setDate(), but it didn't work as I want. Please help me to find a solution. Thanks in advance.
Solution 1:
Follow this link to get the library mCalendarView
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.
Post a Comment for "How To Highlight Multiple Dates In A Android Calendarview Programmatically"