CalendarListview

Additional

Language
Java
Version
v1.2.3 (Dec 16, 2014)
Created
Sep 10, 2014
Updated
Aug 6, 2018
Owner
Robin Chutaux (traex)
Contributor
Robin Chutaux (traex)
1
Activity
Badge
Generate
Download
Source code
APK file

Advertising

CalendarListview

CalendarListview provides a easy way to select dates with a calendar for API 10+. You can find a sample that show how to add DatePickerView to your layout without customization.

Integration

The lib is available on Maven Central, you can find it with Gradle, please

dependencies {
    compile 'com.github.traex.calendarlistview:library:1.2.3'
}

Usage

Declare a DayPickerView inside your layout XML file:

  <com.andexert.calendarlistview.library.DayPickerView
         android:id="@+id/pickerView"
         xmlns:calendar="http://schemas.android.com/apk/res-auto"
         android:layout_width="match_parent"
         android:layout_height="match_parent"/>
         

Next, you have to implement DatePickerController in your Activity or your Fragment. You will have to set getMaxYear and onDayOfMonthSelected. The first one is the max year between the current one and this maxYear. The second one is called every time user selects a new date.

    @Override
    public int getMaxYear()
    {
        return 2015;
    }
    
    @Override
    public void onDayOfMonthSelected(int year, int month, int day)
    {
        Log.e("Day Selected", day + " / " + month + " / " + year);
    }