O'Reilly logo

Android Design Patterns and Best Practice by Kyle Mew

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the factory with the RecyclerView

As we saw briefly earlier in the book, RecyclerViews make use of an internal LayoutManager. This in turn communicates with the data set by use of an adapter. These adapters serve exactly the same function as the adapter design pattern we explored earlier in the book. The function may not appear so readily apparent, but it acts as a connection between a dataset and a recycler view's layout manager. The adapter crosses this bridge with its ViewHolder. The workings of the adapter are neatly separated from the client code, and all we need are a few lines to create a new adapter and layout manager.

With this in mind and our data ready, we can quickly put an adapter together by following these simple steps:

  1. Begin ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required