tezvyn:

What are RecyclerView.Adapter and ViewHolder, and why do they improve scrolling?

Source: developer.android.comintermediate

This tests RecyclerView's data-to-view separation. A strong answer says Adapter binds data while ViewHolder caches findViewById results, avoiding hierarchy scans on scroll. A red flag is calling ViewHolder a memory saver instead of a lookup cache.

This tests whether you understand RecyclerView's data binding and view recycling. A strong answer covers three things in order: first, the Adapter creates ViewHolders and binds data; second, the ViewHolder caches findViewById references so the view hierarchy is traversed only once per item type, not every bind; third, recycling reuses existing holders during scroll, avoiding layout inflation. A red flag is describing ViewHolder as a memory optimization or bitmap cache rather than a lookup cache that skips repeated view lookups.

Read the original → developer.android.com

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

What are RecyclerView.Adapter and ViewHolder, and why do they improve scrolling? · Tezvyn