TimesSquare for Android

Standalone Android widget for picking a single date from a calendar view.



Include CalendarPickerView in your layout XML.


This is a fairly large control so it is wise to give it ample space in your layout. On small
devices it is recommended to use a dialog, full-screen fragment, or dedicated activity. On larger
devices like tablets, displaying full-screen is not recommended. A fragment occupying part of the
layout or a dialog is a better choice.

In the onCreate of your activity/dialog or the onCreateView of your fragment, initialize the
view with a range of valid dates as well as the currently selected date.

Calendar nextYear = Calendar.getInstance();
nextYear.add(Calendar.YEAR, 1);

CalendarPickerView calendar = (CalendarPickerView) findViewById(R.id.calendar_view);
Date today = new Date();
calendar.init(today, nextYear.getTime())

The default mode of the view is to have one selectable date. If you want the user to be able to
select multiple dates or a date range, use the inMode() method:

calendar.init(today, nextYear.getTime())