Benoît Quenaudon
1 min readNov 27, 2017

--

That’s why utilities like DiffUtil exist. In a recyclerView, it will calculate only what needs to be updated and only apply a patch to the view. Even if the calculation is itself heavy, you can run the diff calculation in the background and only apply the patch on the UI thread at the end. See https://github.com/googlesamples/android-architecture-components/blob/master/GithubBrowserSample/app/src/main/java/com/android/example/github/ui/common/DataBoundListAdapter.java#L77-L117

By the way, in my case, except I/O operations or unless there are performance issues, everything is in the UI thread by default in my implementations.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response