Inner workings of LiveData

Viewed 124

If I call LiveData.setValue() before any observers are attached.

Then I attach an observer like so, LiveData.observe(...) will the onChanged() method still be called, or it will only be called if I observe before setValue?

1 Answers

From documents of LiveData method observe you can check here

Adds the given observer to the observers list within the lifespan of the given owner. The events are dispatched on the main thread. If LiveData already has data set, it will be delivered to the observer.

Related