Android RecyclerView for Large Lists | Generated by AI
Correct answer: C. RecyclerView
Why RecyclerView is the preferred choice for large scrolling lists in Android:
- View Recycling: RecyclerView reuses (recycles) item views instead of creating new ones when they scroll off-screen. This dramatically reduces memory usage and improves performance for large or infinite lists.
- Built-in optimization: It uses
ViewHolderpattern by design (mandatory), which eliminates expensivefindViewById()calls during scrolling. - Flexible layouts: Supports
LinearLayoutManager(vertical/horizontal lists),GridLayoutManager, andStaggeredGridLayoutManagerβ so it can replace both ListView and GridView. - Advanced features: Smooth item animations, built-in support for item decorations, diff utils (
ListAdapter+DiffUtil), and better handling of dynamic data changes.
Comparison with others:
| Widget | Suitable for large lists? | View Recycling? | Performance | Notes |
|---|---|---|---|---|
| ListView | Limited | Yes (older impl) | Moderate | Obsolete, lacks flexibility |
| GridView | Limited | Yes (older impl) | Moderate | Only for grids, outdated |
| RecyclerView | Excellent | Yes (optimized) | High | Modern standard |
| ScrollView | Poor | No | Very low | Creates all views at once β OOM risk |
Conclusion: For any large or dynamic scrolling list in modern Android development (2015+), RecyclerView is always the correct and recommended choice. The others are either deprecated or unsuitable for the task.
Your answer C is correct! π