Android
433 bites tagged Android — interview questions with model answers, and 60-second explainers.
Describe state hoisting and its benefits in Compose
Move state to the caller, pass value and event lambda down, keep them stateless. Understanding unidirectional data flow in declarative UI. Internal state in reusable composables or calling hoisting boilerplate.
Explain Jetpack Compose recomposition, its triggers, and optimizations.
This tests grasp of Compose's reactive model. A strong answer defines recomposition as recomputing composables when state changes, notes State triggers it, and explains Compose skips unchanged subtrees via smart tracking.
Arrange UI elements vertically or horizontally in Jetpack Compose
Tests declarative layout fundamentals. Good answers name Column and Row, explain Modifier as an ordered chain of decoration and layout behavior, and note order changes semantics. Red flag: calling Modifier "just styling" or confusing it with LinearLayout.
What is remember in Compose and how do you use mutableStateOf?
This tests state survival across recompositions. Good answers say remember caches values across recompositions, pairs with mutableStateOf for observable state, and shows a counter. A red flag is mutableStateOf without remember, state resets per recomposition.
How does ConstraintLayout enable flat responsive UIs with chains and barriers?
It tests constraint-based positioning and flat hierarchy performance. A strong answer covers relative constraints replacing nested layouts, chains for distributing groups, and barriers for dynamic alignment to extreme edges.
Difference between Style and Theme, and how ?attr/ resolves vs @color/
Probes Android resource indirection depth. A style targets one View; a theme targets a Context. ?attr/ resolves dynamically against the current theme at runtime, but @color/ is a static compile-time constant. Red flag: saying both resolve the same way.
Explain the difference between LinearLayout, RelativeLayout, and FrameLayout
Understanding of ViewGroup measurement and simplicity versus flexibility tradeoffs. LinearLayout for 1D lists, RelativeLayout for complex sibling rules, FrameLayout for single-child or overlap.
How does Android manage ContentProvider lifecycle and threading across processes?
Tests Android IPC and provider architecture. Strong answers explain lazy per-process instantiation via AMS, ContentResolver as the client binder proxy, and query executing on a binder thread. Red flag: claiming the provider runs in the caller process.
What happens to a bound service during config changes and multiple clients?
Tests bound service reference counting. Config change destroys the Activity binding; if no other clients exist, the service stops. Multiple clients keep it alive until the last unbind. Red flag: assuming the service survives config changes without a rebind.
Your app is killed for memory; what runs when the user returns?
Tests process death versus config change. Answer: no callback on kill; return runs onCreate with savedInstanceState, onStart, and onResume. ViewModels die in process death; use SavedStateHandle. Red flag: claiming onDestroy fires or ViewModels survive it.
Static vs dynamic BroadcastReceiver registration and modern Android implications
Tests background limits, lifecycle coupling. Static manifest receivers survive app death but API 26 blocks most implicit broadcasts; dynamic receivers run with the context and must be unregistered. Red flag: static registration handles all implicit broadcasts.
When and why use a Foreground Service on API 26+?
Tests background execution limits. Good answer: use for noticeable long-running work; declare FOREGROUND_SERVICE, show a notification, and respect API 26 background start limits. Red flag: calling it invisible work or omitting the notification.
Describe the back stack for A to B to C with singleTask
Tests singleTask plus taskAffinity, not rote memorization. With default affinity, C sits atop B in the same task; if C already existed, the system clears B and delivers onNewIntent. Red flag: claiming singleTask always spawns a new task.
Activity rotation: what happens to EditText text?
Rotation destroys and recreates the Activity; EditText auto-saves text if it has an ID, else onSaveInstanceState or SavedStateHandle. Activity lifecycle and state on rotation. Always lost, or using SharedPreferences.
Describe the Android Activity lifecycle and callback order
Away calls onPause then onStop; back calls onRestart, onStart, onResume; onCreate only runs after destruction. Activity callback order during user navigation. Claiming onDestroy or onCreate run on every away-and-back.
How do you manage API keys across Gradle build variants securely?
Gitignore a properties file, load it in build.gradle, map secrets to BuildConfig or manifest placeholders by flavor, and commit safe defaults. Gradle secret injection per build variant without committing credentials.
Which Android Studio Profiler tool diagnoses high memory usage and leaks?
Heap dump, check retained size for leaked Activities, trace reference chains to root retainer. Memory Profiler expertise and systematic leak diagnosis. Naming CPU profiler or saying "look for big objects."
What is ADB? Describe two common commands and what they accomplish.
This tests command-line debugging fluency. Define ADB as a client-server bridge, then give two commands such as adb install for APK deployment and adb logcat for streaming device logs. Red flag: calling it the Android Studio debugger or omitting the daemon.
Which Android Studio tool inspects view hierarchy and what does it show?
Tests practical knowledge of runtime UI debugging tools. A strong answer names Layout Inspector, cites live view hierarchy with bounds and attributes, and distinguishes it from the static Layout Editor. Red flag: citing Logcat or the preview pane instead.
Explain what a Gradle product flavor is and give a free vs pro example
Tests understanding of build-variant dimensions beyond build types. A strong answer defines flavorDimensions, sets free and pro applicationIdSuffix values, and explains variant generation. Red flag: conflating flavors with build types or manual APK renaming.
App crash: debug with Logcat and breakpoints in Android Studio
This tests systematic debugging and Android Studio fluency. A strong answer reproduces the crash, filters Logcat for the fatal exception, sets a breakpoint on the offending frame, and inspects variables.
What is the res directory and how do you use orientation qualifiers?
Res/ holds non-code assets; create layout-port/ and layout-land/ with identical XML filenames for automatic framework selection. Android's declarative resource system and runtime configuration adaptation.
What is the difference between project-level and module-level build.gradle?
Project level sets plugin repos and shared versions; module level sets dependencies, build types, and flavors. Gradle scope in multi-module Android projects. Claiming both files do the same thing or misplacing plugins.
What is AndroidManifest.xml and what key elements does it declare?
This tests your grasp of the system-app contract. Good answers cover component registration, permissions, and build metadata like package name and target SDK. A red flag is omitting install-time system discovery.
Get Android bites daily.
Five a day, five minutes, offline. With quizzes so it sticks.
Open testing — you’ll join as an early tester.