Kamrul Islam Shahin
Kamrul Islam Shahin

Reputation: 19

CalendarView show minimum date as today

I want to show calendarView that will set the minimum date as today for booking purposes. But in my code it will show the whole month and here I can book the previous date. So, I need a solution that will show dates available from today and can not select previous days.

How can I do this?

My code:

Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DATE,Calendar.getInstance().getActualMinimum(Calendar.DATE));
long date = calendar.getTime().getTime();
calendar_view.setMinDate(date);

Upvotes: 0

Views: 71

Answers (1)

Mortuza Shahariar
Mortuza Shahariar

Reputation: 94

Here is a solution. You need to set current date to the calendar minimum date.

Calendar calendar = Calendar.getInstance();
mCalendarView.setMinDate(calendar.getTimeInMillis());

Upvotes: 1

Related Questions