Anonymous inner objects
Use of lambdas in event handlers
In the last chapter, we already did some event handling. The part of the exercise where we wrote a function that will increment the value of a text view each time a button is clicked is an exercise on declarative event handling. To bind a function name to a click event, we simply set a View’s android:onClick attribute to the name of a function. This is a simple and low-ceremony way to handle events, but it is limited to only the “click” event. When you need to handle events like ...