You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 10, 2025. It is now read-only.
// Observe product data
model.getObservableProduct().observe(this, new Observer<ProductEntity>() {
@Override
public void onChanged(@Nullable ProductEntity productEntity) {
model.setProduct(productEntity);
}
});
We observe for a change in LiveData<ProductEntity> mObservableProduct. When a change is there we set ObservableField<ProductEntity> product so that the data-binding library updates the UI. It seems like too much work perhaps.
My understanding would be that since LiveData cares about the lifecycle owner and not the view, hence databinding doesn't support LiveData. Is that so? @yigit
If this is the right way of doing it, is there any better way of using Data-Binding with LiveData?