Android Performance Optimization Flashcards
7 cards from real Android Development practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 7 Android Performance Optimization flashcards as text
What is the purpose of the RecyclerView.RecycledViewPool in Android?
Answer: To share recycled ViewHolders across multiple RecyclerViews
RecycledViewPool allows multiple RecyclerViews to share a pool of recycled ViewHolders, reducing view inflation overhead when displaying similar list content.
What does 'overdraw' mean in the context of Android rendering performance?
Answer: A pixel being painted more than once per frame
Overdraw occurs when a pixel is drawn multiple times in a single frame (e.g., due to overlapping backgrounds), wasting GPU time and reducing rendering performance.
Which Android feature allows deferring the inflation of part of a layout until it is actually needed, improving initial load time?
Answer: ViewStub
ViewStub is a lightweight, invisible View that is replaced by the inflated layout only when explicitly made visible or inflated, reducing startup inflation cost.
What is the main benefit of using ConstraintLayout over nested LinearLayouts or RelativeLayouts?
Answer: It flattens the view hierarchy, reducing measure/layout passes
ConstraintLayout expresses complex layouts in a single flat hierarchy, avoiding nested layouts that require multiple measure/layout passes and hurt rendering performance.
When using Room database, what should you avoid doing on the main thread to prevent ANR errors?
Answer: Running database queries synchronously
Room by default throws an exception if database queries are run on the main thread; they should be executed on a background thread (e.g., using coroutines or LiveData) to prevent blocking the UI.
What is 'baseline profiles' in Android, and what is their primary benefit?
Answer: Pre-compiled bytecode rules that speed up app startup and frame rendering
Baseline Profiles provide pre-compilation hints that let ART ahead-of-time compile critical code paths, significantly improving startup time and reducing jank during early app use.
Which Jetpack library provides built-in support for pagination, loading large data sets from a data source in chunks to improve performance?
Answer: Paging 3
The Paging 3 library handles loading data in pages from network or database sources, integrating with RecyclerView and LiveData/Flow to display large datasets efficiently.