LiveDataEvent

Extension of the MutableLiveData acting as single-shot observable event. Once a new data value is set, then the attached observer is notified only once. Note that only one observer is going to be notified of changes.

Important: This is a Public Preview API. It may be changed or removed at any time.

Constructors

Link copied to clipboard

Functions

Link copied to clipboard
open fun getValue(): T?
Link copied to clipboard
Link copied to clipboard
open fun hasObservers(): Boolean
Link copied to clipboard
open override fun observe(owner: LifecycleOwner, observer: Observer<in T>)

Sets a new observer.

Link copied to clipboard
Link copied to clipboard
open override fun postValue(value: T)

Posts a task to the main thread to set the given value.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun setValue(t: T?)

Sets the value. If there are active observers, the value will be dispatched to them.