observe

expect open fun observe(owner: LifecycleOwner, observer: Observer<in T>)

Observe the data object.

The data object will notify its Observer in the following scenarios:

  1. When the observation starts: LiveData.observe.

  2. When the Observer moves from not observing to observing.

  3. When the value changes: LiveData.getValue.

Parameters

owner

The lifetime for which to observe the data object, after which it will be removed.

observer

The object observing the change.

See also