{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}
public final class PagingLiveData
Public methods |
|
---|---|
static final @NonNull <ERROR CLASS> |
<T extends Object> cachedIn( Operator which caches a LiveData of |
static final @NonNull <ERROR CLASS> |
<T extends Object> cachedIn( Operator which caches a LiveData of |
static final @NonNull <ERROR CLASS> |
<T extends Object> cachedIn( Operator which caches a LiveData of |
@NonNull
public static final <ERROR CLASS> <T extends Object> cachedIn(
@NonNull <ERROR CLASS><@NonNull PagingData<@NonNull T>> receiver,
@NonNull <ERROR CLASS> lifecycle
)
Operator which caches a LiveData of PagingData
within the scope of a Lifecycle.
cachedIn
multicasts pages loaded and transformed by a PagingData
, allowing multiple observers on the same instance of PagingData
to receive the same events, avoiding redundant work, but comes at the cost of buffering those pages in memory.
Calling cachedIn
is required to allow calling androidx.paging.AsyncPagingDataAdapter on the same instance of PagingData
emitted by Pager
or any of its transformed derivatives, as reloading data from scratch on the same generation of PagingData
is an unsupported operation.
Parameters | |
---|---|
@NonNull <ERROR CLASS> lifecycle |
The Lifecycle where the page cache will be kept alive. |
@NonNull
public static final <ERROR CLASS> <T extends Object> cachedIn(
@NonNull <ERROR CLASS><@NonNull PagingData<@NonNull T>> receiver,
@NonNull <ERROR CLASS> viewModel
)
Operator which caches a LiveData of PagingData
within the scope of a ViewModel.
cachedIn
multicasts pages loaded and transformed by a PagingData
, allowing multiple observers on the same instance of PagingData
to receive the same events, avoiding redundant work, but comes at the cost of buffering those pages in memory.
Calling cachedIn
is required to allow calling androidx.paging.AsyncPagingDataAdapter on the same instance of PagingData
emitted by Pager
or any of its transformed derivatives, as reloading data from scratch on the same generation of PagingData
is an unsupported operation.
Parameters | |
---|---|
@NonNull <ERROR CLASS> viewModel |
The ViewModel whose viewModelScope will dictate how long the page cache will be kept alive. |
@NonNull
public static final <ERROR CLASS> <T extends Object> cachedIn(
@NonNull <ERROR CLASS><@NonNull PagingData<@NonNull T>> receiver,
@NonNull CoroutineScope scope
)
Operator which caches a LiveData of PagingData
within a CoroutineScope
.
cachedIn
multicasts pages loaded and transformed by a PagingData
, allowing multiple observers on the same instance of PagingData
to receive the same events, avoiding redundant work, but comes at the cost of buffering those pages in memory.
Calling cachedIn
is required to allow calling androidx.paging.AsyncPagingDataAdapter on the same instance of PagingData
emitted by Pager
or any of its transformed derivatives, as reloading data from scratch on the same generation of PagingData
is an unsupported operation.
Parameters | |
---|---|
@NonNull CoroutineScope scope |
The |