Android Calender View is fork from https://code.google.com/p/android-calendar-view/ to support using it from Android Studio as a library.
Android does not offer any calendar view in the SDK. This project is an option for that. Developer can import and use com.exina.android.calendar.CalendarView.CalendarView to display a specified date in a month view, or let user pick up a date from it.
Add the following code to an activity or fragment to use the calendar view:
private OnDateSetListener listener = new OnDateSetListener() {
@Override
public void onDateSet(com.exina.android.calendar.CalendarView.CalendarView view, int year, int monthOfYear, int dayOfMonth) {
// Place your code here
}
};
public CalendarPickerDialog createCalendarPickerDialog(Calendar calendar) {
int cyear = calendar.get(Calendar.YEAR);
int cmonth = calendar.get(Calendar.MONTH);
int cday = calendar.get(Calendar.DAY_OF_MONTH);
CalendarPickerDialog calendarPicker = new CalendarPickerDialog(getActivity(), listener, cyear, cmonth, cday);
return calendarPicker;
}
Add maven central to your build.gradle
:
buildscript {
repositories {
jcenter()
}
}
repositories {
jcenter()
}
Add maven central to your build.gradle
:
buildscript {
repositories {
mavenCentral()
}
}
repositories {
mavenCentral()
}
Then declare Android Calendar View within your dependencies:
dependencies {
...
compile('com.thomashaertel:android-calendar-view:0.5.0@aar') {
}
...
}
To use Android Calendar View within your maven build simply add
<dependency>
<artifactId>android-calendar-view</artifactId>
<version>${android-calendar-view.version}</version>
<groupId>com.thomashaertel</groupId>
</dependency>
to your pom.xml
If you also want the sources or javadoc add the respective classifier
<classifier>sources</classifier>
or
<classifier>javadoc</classifier>
to the dependency.