Recyclerview is scrolled up when dispatchUpdatesTo is called

33 Views Asked by At

Recyclerview is scrolled to its top when dispatchUpdatesTo method is called after calculating Diffutil difference, even after state is stored.

  1. Tried saving state and restoring, but not working.
  2. Tried by removing thread and it worked.
compositeDisposable.clear()
            compositeDisposable += Single.fromCallable {
                DiffUtil.calculateDiff(diffUtilCallback(items, newItems))
            }.subscribeOn(Schedulers.computation())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(
                    Consumer {
                        this.items.clear()
                        this.items.addAll(newItems)
                        it.dispatchUpdatesTo(this)
                    }
                )
0

There are 0 best solutions below