-
- All Implemented Interfaces:
public class LiveEvent<T extends Object> extends MediatorLiveData<T>
A class to handle single live events in Android MVVM architectural pattern to propagate the data as an event, which means it emits data just once, not after configuration changes again. Note that event will only be sent to active observers, any observers that started observing after the emit won't be notified of the event.
-
-
Field Summary
Fields Modifier and Type Field Description private final ObjectmDataLockprivate final IntegermActiveCountprivate final ObjectmPendingData
-
Constructor Summary
Constructors Constructor Description LiveEvent()
-
Method Summary
Modifier and Type Method Description Unitobserve(LifecycleOwner owner, Observer<in T> observer)UnitobserveForever(Observer<in T> observer)UnitremoveObserver(Observer<in T> observer)UnitsetValue(T t)-
Methods inherited from class androidx.lifecycle.MutableLiveData
changeActiveCounter, dispatchingValue, getValue, getVersion, hasActiveObservers, hasObservers, removeObservers -
Methods inherited from class androidx.lifecycle.MediatorLiveData
postValue -
Methods inherited from class apptentive.com.android.core.LiveEvent
addSource, onActive, onInactive, removeSource -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
observe
@MainThread() Unit observe(LifecycleOwner owner, Observer<in T> observer)
-
observeForever
@MainThread() Unit observeForever(Observer<in T> observer)
-
removeObserver
@MainThread() Unit removeObserver(Observer<in T> observer)
-
setValue
@MainThread() Unit setValue(T t)
-
-
-
-