

This can be done by creating a instance of the RecycledViewPool class which is a static class inside RecyclerView and setting the same RecycledViewPool for each of the child RecyclerView by calling tRecycledViewPool(mRecycledViewPool). Many times these child RecyclerViews share common ViewTypes, but each of these Individual RecyclerView creates extra RecycledViews for these common ViewTypes in their own RecycledViewPool because they have no way of knowing that the other RecyclerView already has a RecycledView in memory within it’s RecycledViewPool.Īctually, there is a way to achieve this, by using a common RecycledViewPool for each of these child RecyclerView. One such example can be seen in the Google PlayStore app itself. Nesting Horizontal RecyclerViews inside a Vertical RecyclerView is a very common Design Pattern seen across apps these days. Have a common RecycledViewPool for Nested RecyclerViews This is when we should release resources held by the ViewHolder.

In this blog post, I am going to tell you about a few optimisations and how caching works inside RecyclerView so that you can tweak them at will to get the best out of your Apps. So, knowing little tricks to optimise the performance of this monster in tiny ways is not a bad skill to have.

RecyclerView is one of those Widgets that you will use over and over again while developing Android Apps.
