当我移动到另一个片段时,如何恢复分页适配器项目状态?我尝试了下面的文章,但没有奏效。 https://medium.com/@florina.muntenescu
private fun loadData() {
viewModel.apply {
lifecycleScope.launch{
viewModel.getMorePopularMovies().collectLatest { pagingData ->
dataAdapter.submitData(viewLifecycleOwner.lifecycle, pagingData)
}
}
}
}
fun getMorePopularMovies() = Pager(
PagingConfig(pageSize = 3)
) {
VerticalMoviePagingSource(api, "Popular")
}.flow