How and where to use Transformations.switchMap?
In the map() function LiveData userLiveData = …; LiveData userName = Transformations.map(userLiveData, user -> { return user.firstName + ” ” + user.lastName; // Returns String }); everytime the value of userLiveData changes, userName will be updated too. Notice that we are returning a String. In the switchMap() function: MutableLiveData userIdLiveData = …; LiveData userLiveData = … Read more