Comment on page
4.2 RecyclerView Performance
For a RecyclerView, each item in the dataset is represented by a cell in the list. Only the cells that are immediately visible to the user are created at runtime; the hidden cells will be rendered as you scroll. This is how the compiler handles the rendering of the list.
The recycler view only creates the cells that are immediately visible to the user, but the recycler view utilizes the
ViewHolderpattern, a holder for cell metadata that maximizes performance by reducing the amount of times that
view.findViewById()is called by the system. As the user scrolls, the recycler view will either create new view holders as necessary or reuse the view holders that have been offscreen the longest. By reusing view holders, we can reduce the number of calls to
RecyclerViewhas many in-app memory optimization that is already completed for developers. For example,
RecyclerViewforces developers to use the
RecyclerViewwas created as a direct enhancement to
ListViewwhich we will learn about in lecture 5 and thus,
RecyclerViewis easier to use and manipulate for complex lists. However, as you will see in Lecture 5, there will be instances where it makes more sense to use a
ListViewto save development time, like with the menu in Eatery. We'll go into more detail about this in the next section.