I am using Transformations.switchMap in my ViewModel so my LiveData
collection, observed in my fragment, reacts on changes of code
parameter.
I faced a similar problem. There are 2 ways to solve this:
MediatorLiveData
If you don't know RxJava, then I'd recommend writing your custom MediatorLiveData
class.
To learn how write custom MediatorLiveData
class check out this example:
https://gist.github.com/AkshayChordiya/a79bfcc422fd27d52b15cdafc55eac6b