be used in your layouts. Use them minimally because placing logic in your layouts makes testing impossible. There are some useful ones like the null coalescing operator and the ternary operand. The null coalescing operator choses the left operand if it isn’t null or the right if the left is null.
with the data we require. By using a data class you get methods like toString(), equals() , hashCode() and copy() automatically, you don’t have to override them.
said, you shouldn’t put complex logic in your XML, instead use ViewModels. It’s testable and you’ll get to write more Kotlin code. You can get a reference to the ViewModel using the variable tag in your layout.
the appropriate framework methods to set the values of your layout views. You can also define custom attributes in your XML layouts with custom binding adapters.
type of attribute is errorImage? This is one of the many parts of data binding that really shines. With custom binding adapters, you don’t have to write custom attributes in your custom view; just use a binding adapter.
function in your custom view. This also works with the android framework classes that have setter methods but no layout attributes. The DrawerLayout is a good example.