I have a chat-like activity where I am using a RecyclerView with a PagedListAdaper to load a bunch of messages. I\'m using a PositionalDataSource to load the data. The loading i
you should use sync in loadInitial
and loadAfter
, ie:
mLoadState.postValue(NetworkState.Loading);
try {
mLoadState.postValue(NetworkState.DONE);
ResultMessage> info = call.execute().body();
if (info != null && info.isSuccess()) {
List list = info.getData();
callback.onResult(list, null, FIRST_PAGE + 1);
}
} catch (IOException e) {
mLoadState.postValue(NetworkState.ERROR);
mRetry.postValue(() -> loadInitial(params, callback));
Log.d(TAG, "fail!");
}