androidx.lifecycle
Interfaces
DefaultLifecycleObserver |
Callback interface for listening to |
HasDefaultViewModelProviderFactory |
Interface that marks a |
LifecycleEventObserver |
Class that can receive any lifecycle change and dispatch it to the receiver. |
LifecycleObserver |
Marks a class as a LifecycleObserver. |
LifecycleOwner |
A class that has an Android lifecycle. |
LifecycleRegistryOwner | |
LiveDataScope |
Interface that allows controlling a LiveData from a coroutine block. |
Observer |
A simple callback that can receive from |
Factory |
Implementations of |
ViewModelStoreOwner |
A scope that owns |
Classes
AbstractSavedStateViewModelFactory |
Skeleton of androidx. |
AndroidViewModel |
Application context aware |
Lifecycle |
Defines an object that has an Android Lifecycle. |
LifecycleCoroutineScope |
CoroutineScope tied to a Lifecycle and Dispatchers.Main.immediate |
LifecycleRegistry |
An implementation of |
LifecycleService |
A Service that is also a |
LiveData |
LiveData is a data holder class that can be observed within a given lifecycle. |
LiveDataReactiveStreams |
Adapts |
MediatorLiveData |
|
MutableLiveData |
|
ProcessLifecycleOwner |
Class that provides lifecycle for the whole application process. |
SavedStateHandle |
A handle to saved state passed down to |
SavedStateViewModelFactory |
|
ServiceLifecycleDispatcher |
Helper class to dispatch lifecycle events for a service. |
Transformations |
Transformation methods for |
ViewModel |
ViewModel is a class that is responsible for preparing and managing the data for an |
ViewModelLazy |
An implementation of Lazy used by androidx.fragment.app.Fragment.viewModels and androidx.activity.ComponentActivity.viewmodels. |
ViewModelProvider |
An utility class that provides |
ViewModelProviders |
Utilities methods for |
ViewModelStore |
Class to store |
ViewModelStores |
Factory methods for |
ViewTreeLifecycleOwner |
Accessors for finding a view tree-local |
ViewTreeViewModelStoreOwner |
Accessors for finding a view tree-local |
Exceptions
LifecycleDestroyedException |
A CancellationException that indicates that the Lifecycle associated with an operation reached the Lifecycle.State.DESTROYED state before the operation could complete. |
Annotations
OnLifecycleEvent |
Top-level functions summary
LiveData<T> |
liveData(context: CoroutineContext = EmptyCoroutineContext, timeoutInMs: Long = DEFAULT_TIMEOUT, block: suspend LiveDataScope<T>.() -> Unit) Builds a LiveData that has values yielded from the given block that executes on a LiveDataScope. |
LiveData<T> |
liveData(context: CoroutineContext = EmptyCoroutineContext, timeout: Duration, block: suspend LiveDataScope<T>.() -> Unit) Builds a LiveData that has values yielded from the given block that executes on a LiveDataScope. |
Extension functions summary
For android.view.View | |
LifecycleOwner? |
Locates the LifecycleOwner responsible for managing this View, if present. |
ViewModelStoreOwner? |
Locates the ViewModelStoreOwner associated with this View, if present. |
For kotlinx.coroutines.flow.Flow | |
LiveData<T> |
Flow<T>.asLiveData(context: CoroutineContext = EmptyCoroutineContext, timeoutInMs: Long = DEFAULT_TIMEOUT) Creates a LiveData that has values collected from the origin Flow. |
LiveData<T> |
Flow<T>.asLiveData(context: CoroutineContext = EmptyCoroutineContext, timeout: Duration) Creates a LiveData that has values collected from the origin Flow. |
For org.reactivestreams.Publisher | |
LiveData<T> |
Publisher<T>.toLiveData() Creates an observable LiveData stream from a ReactiveStreams Publisher. |
For LiveData | |
Flow<T> |
Creates a Flow containing values dispatched by originating LiveData: at the start a flow collector receives the latest value held by LiveData and then observes LiveData updates. |
LiveData<X> |
Creates a new LiveData object does not emit a value until the source |
LiveData<Y> |
Returns a LiveData mapped from |
Observer<T> |
LiveData<T>.observe(owner: LifecycleOwner, crossinline onChanged: (T) -> Unit) Adds the given onChanged lambda as an observer within the lifespan of the given owner and returns a reference to observer. |
LiveData<Y> |
Returns a LiveData mapped from the input |
Publisher<T> |
LiveData<T>.toPublisher(lifecycle: LifecycleOwner) Adapts the given LiveData stream to a ReactiveStreams Publisher. |
For ViewModelProvider | |
VM |
Returns an existing ViewModel or creates a new one in the scope (usually, a fragment or
an activity), associated with this |
For LifecycleOwner | |
suspend T |
LifecycleOwner.whenCreated(block: suspend CoroutineScope.() -> T) Runs the given block when the LifecycleOwner's Lifecycle is at least in Lifecycle.State.CREATED state. |
suspend T |
LifecycleOwner.whenResumed(block: suspend CoroutineScope.() -> T) Runs the given block when the LifecycleOwner's Lifecycle is at least in Lifecycle.State.RESUMED state. |