January 2017
Beginner to intermediate
624 pages
22h 42m
English
Complete coverage of data binding is outside the scope of this book. And yet, reader, we must nevertheless try.
You can write short callbacks directly in your layout file by using lambda expressions. These are simplified versions of Java’s lambda expressions:
<Button
android:layout_width="match_parent"
android:layout_height="120dp"
android:text="@{viewModel.title}"
android:onClick="@{(view) -> viewModel.onButtonClick()}"
tools:text="Sound name"/>
Like Java 8 lambda expressions, these are turned into implementations for the interface you use them for. (In this case, View.OnClickListener.) Unlike Java 8 lambda expressions, these expressions must use this exact ...
Read now
Unlock full access