it is happening to me that when I have a LiveData< String > (or any primitive type) and I change its value by doing liveDataObject.setValue("exampleValue)
the observer in my fragment is notified and it does works correctly.
But, when instead of a primitive type, the LiveData is made by a POJO or a Bean, like LiveData< Player>:
public class Player { private int number; private String name, private Team team //getters and setters}
then, in order to update its attributes, for each correspondent event I'd like to call something like getPlayer().getValue().setPlayerName("Jordan");
getPlayer() returning the LiveData< Player > instance, getValue() the Player inside the LiveData object... The problem is that this is not notifying the observers about a change, because it only notifies when I use the :
liveDataObject.setValue(new Player(...))
what I think is not appropiate to call every time an attribute of the player changes... Do you know the correct way to do this?
Thank you