Setting up an item click on RecyclerView

RecyclerView is also a very core part of Android application development. You won't find an app that is not using RecyclerViewWe love it, but we also miss setOnItemClickListener() of ListView don't we? Well, what if we tell you that instead of having a listener every time for it we can simply define what to do using Lambdas. With Kotlin it's possible.

To understand this properly we need to go a bit deeper into functions and operators. Kotlin has various operators overloaded such as unary operators, binary operators, indexed access operator, invoke operator, equality and inequality operator, and augmented assignments. The invoke() operator will help us easily write an item listener. Let's try to understand ...

Get Kotlin Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.