I am trying to get the CalendarView widget to display only 1 week from current date. I tried using ,
Date date = new Date();
cal = (CalendarView) findViewById(R.id.calendarView1);
cal.setMaxDate(date.getTime()+604800000);
cal.setMinDate(date.getTime());
but it doesn't seem to work. Really appreciate if someone could help me out.
u can set like this here eg. i set the date to 25 -12(december)- current year. You want something like: just get 1 week from current date and u can set like this also
public static Calendar defaultCalendar() {
Calendar currentDate = Calendar.getInstance();
currentDate.set(Calendar.MONTH, 11); // Months are 0-based!
currentDate.set(Calendar.DAY_OF_MONTH, 25); // Clearer than DATE
return currentDate;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.