In my ViewModel, I load data using
private val pagingConfig = PagedList.Config.Builder()
.setEnablePlaceholders(false)
.setInitialLoadSizeHint(INITIAL_LOAD_SIZE_HINT)
.setPageSize(PAGE_SIZE)
.build()
val notificationList = LivePagedListBuilder<Long, Notification>(dataSourceFactory, pagingConfig).build()
Which works fine. However, when my data changes, LiveData<PagedList<Notification>>
does not get notified. Is there anything I can do to trigger LiveData
refresh (the ViewModel
knows when the change occurs).
You can trigger data update using
invalidate()
method from theDataSource
.More information: Notify when data is invalid