Categories android-data-binding

2 posts

Auto Added by WPeMatico

The ugly OnPropertyChangedCallback

https://www.flickr.com/photos/hpeake/28395138972 Data binding is an amazing feature in Android development. We can bind view model properties directly to the XML, the place where they are needed. No ugly ‘handwritten’ glue code in between, which also means less code in the Activities and Fragments. But sometimes we need to intervene manually. […]

Custom attributes using BindingAdapters in Kotlin

Using the Android data binding framework it’s easy to define a custom attribute that can be used in a layout files. It’s just a static method with the right parameters annotated with @BindingAdapter. The most common example is a method that allows to use Glide or Picasso to populate an […]