free
web stats

Android – Using Material Calendar View

Android Calendar Example

I this post we have to learn how to create Calendar in android with View Library.

Firstly we’re going to create new empty android project like this.

Go to build.gradle(Module.app) and add this code;

compile ‘com.prolificinteractive:material-calendarview:1.4.3’

Then click Sync Now button.

build.gradle file must be like this. We are add material calenderview in our project.

Important: Your minimun SDK Version must be equal or big 14. In gradle file minSDKVersion.

Now we can use Calendar View in our porject. Here is view code for material calendar view;

We are going to paste this code in activity_main.xml.

activity_main.xml file codes here;

Now go to MainActivity.java class and add these codes;

 

In here, We are using MaterialCalendarView libs. Firstly we set calendar minimum date, maximum date, display mode(Months, weeks etc…)

Lastly change setOnDateChangedListener method. We’re sending clicked date to Toast.

Here is example screen shot;

 

 

 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *