Challenge - 5 Problems
Dynamic List Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediateWhy RecyclerView is efficient for large lists
Which feature of RecyclerView helps it display large lists efficiently without slowing down the app?
Attempts:
2 left
💡 Hint
Think about how the app avoids creating too many views at once.
✗ Incorrect
RecyclerView reuses views that go off screen to show new items, saving memory and improving speed.
❓ ui_behavior
intermediateEffect of ViewHolder pattern on scrolling
What happens to the app's scrolling performance when the ViewHolder pattern is NOT used in a dynamic list?
Attempts:
2 left
💡 Hint
Consider the cost of creating views repeatedly during scroll.
✗ Incorrect
Without ViewHolder, the app creates new views for each item during scroll, causing lag.
❓ lifecycle
advancedRecyclerView Adapter lifecycle impact
Which RecyclerView.Adapter method is called to bind data to a recycled view when it reappears on screen?
Attempts:
2 left
💡 Hint
This method updates the content of an existing view.
✗ Incorrect
onBindViewHolder binds new data to an existing recycled view to display updated content.
advanced
Handling item clicks in dynamic lists
What is the best way to handle item clicks in a RecyclerView to navigate to a detail screen?
Attempts:
2 left
💡 Hint
Listeners should be set once per recycled view to avoid multiples and use current position via getAdapterPosition().
✗ Incorrect
Setting click listeners inside onCreateViewHolder ensures they are attached once per view, and the current position/data can be obtained using holder.adapterPosition on click.
🔧 Debug
expertIdentifying cause of RecyclerView lag
You notice your RecyclerView scrolls very slowly. Which code snippet below is most likely causing this lag?
Android Kotlin
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val item = dataList[position]
holder.textView.text = item.text
val bitmap = BitmapFactory.decodeResource(holder.itemView.context.resources, R.drawable.large_image)
holder.imageView.setImageBitmap(bitmap)
}Attempts:
2 left
💡 Hint
Think about expensive operations inside scrolling methods.
✗ Incorrect
Decoding large images inside onBindViewHolder runs on the main thread repeatedly, causing lag.
