Sreelakshmi C
Sreelakshmi C

Reputation: 11

Recyclerview is scrolled up when dispatchUpdatesTo is called

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)
                    }
                )

Upvotes: 1

Views: 47

Answers (0)

Related Questions