I have implemented epoxy according epoxy Wiki.
I have several List<items>. I update the controller with the first List<items>, everything works fine. But then I update with the next List<items>, data showed properly from second List<items> in Epoxy View Models, but callbacks are not updated with new items object in listeners callbacks, they are pointing to the first List<items> objects.
This is Epoxy controller part to build models:
@Override
protected void buildModels(List<Item> items) {
for (Item item : items) {
new ItemModel_()
.id(item.getId())
.title(item.getTitle())
.clickListener((model, parentView, clickedView, position) -> callbacks.onItemClicked(item))
.addTo(this);
}
}
In epoxy-sample I found clickListener callbacks with lambda implementation. Shown above: .clickListener((model, parentView, clickedView, position) -> callbacks.onItemClicked(item)).
I update controller data with different data Lists of List<items>, changing all List<items>in controller.setData(List<items>); according user requests.