I have used data-binding for a while, even now it is not available for JDK 8 and API 24 now. I still find a way to use the data binding in a easier way. But when I use the follo
I feel that ObservableField
approach is the way to go as there's no need to write getters/setters OR invoke notifyPropertyChanged
.
Also, if you have a custom object ObservableField
, and you use android:text="@{viewModel.studentField.name}
, the text does get updated when you invoke studentField.set(newStudent)
.
I find RxJava very useful. ObservableField
can be easily converted to rx.Observable
and vice versa. This allows use of Rx operators. In case you are interested, you can check the implementation here: FieldUtils.java