Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

androidx.lifecycle

Classes

AbstractSavedStateVMFactory

Skeleton of androidx.

AndroidViewModel

Application context aware ViewModel.

Lifecycle

Defines an object that has an Android Lifecycle.

LifecycleRegistry

An implementation of Lifecycle that can handle multiple observers.

LifecycleService

A Service that is also a LifecycleOwner.

LiveData

LiveData is a data holder class that can be observed within a given lifecycle.

LiveDataReactiveStreams

Adapts LiveData input and output to the ReactiveStreams spec.

MediatorLiveData

LiveData subclass which may observe other LiveData objects and react on OnChanged events from them.

MutableLiveData

LiveData which publicly exposes setValue(T) and postValue(T) method.

ProcessLifecycleOwner

Class that provides lifecycle for the whole application process.

SavedStateHandle

A handle to saved state passed down to ViewModel.

SavedStateVMFactory

ViewModelProvider.Factory that can create ViewModels accessing and contributing to a saved state via SavedStateHandle received in a constructor.

ServiceLifecycleDispatcher

Helper class to dispatch lifecycle events for a service.

Transformations

Transformation methods for LiveData.

ViewModel

ViewModel is a class that is responsible for preparing and managing the data for an Activity or a Fragment.

ViewModelLazy

An implementation of Lazy used by androidx.fragment.app.Fragment.viewModels and androidx.activity.ComponentActivity.viewmodels.

ViewModelProvider

An utility class that provides ViewModels for a scope.

ViewModelProviders

Utilities methods for ViewModelStore class.

ViewModelStore

Class to store ViewModels.

ViewModelStores

Factory methods for ViewModelStore class.

Annotations

OnLifecycleEvent

Extension functions summary

For org.reactivestreams.Publisher
LiveData<T>
Publisher<T>.toLiveData()

Creates an observable LiveData stream from a ReactiveStreams Publisher.

For LiveData
Publisher<T>

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 ViewModelProvider.

Extension properties summary

For ViewModel
CoroutineScope

CoroutineScope tied to this ViewModel.

Extension functions

get

@MainThread inline fun <reified VM : ViewModel> ViewModelProvider.get(): VM

Returns an existing ViewModel or creates a new one in the scope (usually, a fragment or an activity), associated with this ViewModelProvider.

toLiveData

inline fun <T> Publisher<T>.toLiveData(): LiveData<T>

Creates an observable LiveData stream from a ReactiveStreams Publisher.

toPublisher

inline fun <T> LiveData<T>.toPublisher(lifecycle: LifecycleOwner): Publisher<T>

Adapts the given LiveData stream to a ReactiveStreams Publisher.

Extension properties

viewModelScope

val ViewModel.viewModelScope: CoroutineScope

CoroutineScope tied to this ViewModel. This scope will be canceled when ViewModel will be cleared, i.e ViewModel.onCleared is called

This scope is bound to Dispatchers.Main