Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setMonthScrollListener in Java #74

Closed
rejsiperpalaj opened this issue Nov 4, 2019 · 3 comments
Closed

setMonthScrollListener in Java #74

rejsiperpalaj opened this issue Nov 4, 2019 · 3 comments

Comments

@rejsiperpalaj
Copy link

rejsiperpalaj commented Nov 4, 2019

I want to call this listener in java class. How can i do that?

@rejsiperpalaj
Copy link
Author

My problem got fixed when I configured Kotlin compiler and runtime for my Java module with the latest stable version (currently 1.3.50)

Just go to Tools > Kotlin > Configure Kotlin in Project > Android with Gradle and choose your Java module with Single module radio button selected then select your version and OK.

@hulisani-mudimeli
Copy link

Hi @rejsiperpalaj, I just configured kotlin in project, would you please send your code snippet where you use setMonthScrollListener?

@kizitonwose
Copy link
Owner

kizitonwose commented Apr 21, 2020

@hulisani-mudimeli Note that with newer versions of Android Studio, you do not need to configure Kotlin in the project as described above. After you have added the Calendar library dependency, the scroll listener Java code should look like this:

calendarView.setMonthScrollListener(new Function1<CalendarMonth, Unit>() {
    @Override
    public Unit invoke(CalendarMonth calendarMonth) {
        // Use calendarMonth
        return Unit.INSTANCE;
    }
});

Or shorter:

calendarView.setMonthScrollListener(calendarMonth -> {
    // Use calendarMonth
    return Unit.INSTANCE;
});

Repository owner locked and limited conversation to collaborators Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants