Kotlin setOnClickListener using method reference not working

Kotlin setOnClickListener using method reference not working

I tried to use method reference the same way as in Java:

I tried to use method reference the same way as in Java:

button.setOnClickListener(this::clickListener);

Using Kotlin:

button.setOnClickListener {this::clickListener}

However this doesn't work in Kotlin, the solution is to actually invoke the function withing the labmda expression:

button.setOnClickListener {clickListener()}

Why Kotlin doesn't accept the method reference in this case? Isn't the same principle as with Java?

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Kotlin Coroutines on Android - How to use Coroutines on Android

Coroutines are a Kotlin feature that convert async callbacks for long-running tasks, such as database or network access, into sequential code. This Kotlin Coroutines tutorial will show you how to use coroutines on Android, and how the new androidx-concurrent library makes it easy to use them to get things off the main thread. You'll also learn how the new library helps coroutines work with Architecture Components. This session also covers coroutine patterns, best practices, and even how to test coroutines!

What's New in Java 19: The end of Kotlin?

What's New in Java 19: The end of Kotlin? Will Kotlin still have a place in the JVM language ecosystem in a few years? This tutorial will compare and contrast how the two languages approach solving the same problems of today's Java. We'll peer a few years into the future to see where both languages are headed and determine whether we still need a Kotlin

Kotlin vs Java: Which is the best for Android Developers?

In this article will help you spot the major differences between Kotlin vs Java