tezvyn:

Android & Kotlin

Jetpack Compose, Android Studio, Kotlin, Material You

411 bites

More in Android & Kotlin — page 6

What is remember in Compose and how do you use mutableStateOf?
Android & Kotlin2 min read

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.

Android & Kotlin2 min read

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/
Android & Kotlin2 min read

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
Android & Kotlin2 min read

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.

Android & Kotlin2 min read

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?
Android & Kotlin2 min read

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?
Android & Kotlin2 min read

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
Android & Kotlin2 min read

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+?
Android & Kotlin2 min read

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
Android & Kotlin2 min read

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?
Android & Kotlin2 min read

Activity rotation: what happens to EditText text?

WHAT IT TESTS: Activity lifecycle and state on rotation. ANSWER OUTLINE: Rotation destroys and recreates the Activity; EditText auto-saves text if it has an ID, else onSaveInstanceState or SavedStateHandle. RED FLAG: Always lost, or using SharedPreferences.

Describe the Android Activity lifecycle and callback order
Android & Kotlin2 min read

Describe the Android Activity lifecycle and callback order

WHAT IT TESTS: Activity callback order during user navigation. ANSWER OUTLINE: Away calls onPause then onStop; back calls onRestart, onStart, onResume; onCreate only runs after destruction. RED FLAG: Claiming onDestroy or onCreate run on every away-and-back.

Android & Kotlin2 min read

How do you manage API keys across Gradle build variants securely?

WHAT IT TESTS: Gradle secret injection per build variant without committing credentials. ANSWER OUTLINE: Gitignore a properties file, load it in build.gradle, map secrets to BuildConfig or manifest placeholders by flavor, and commit safe defaults.

Which Android Studio Profiler tool diagnoses high memory usage and leaks?
Android & Kotlin2 min read

Which Android Studio Profiler tool diagnoses high memory usage and leaks?

WHAT IT TESTS: Memory Profiler expertise and systematic leak diagnosis. ANSWER OUTLINE: Heap dump, check retained size for leaked Activities, trace reference chains to root retainer. RED FLAG: Naming CPU profiler or saying "look for big objects."

What is ADB? Describe two common commands and what they accomplish.
Android & Kotlin2 min read

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?
Android & Kotlin2 min read

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
Android & Kotlin2 min read

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
Android & Kotlin2 min read

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?
Android & Kotlin2 min read

What is the res directory and how do you use orientation qualifiers?

WHAT IT TESTS: Android's declarative resource system and runtime configuration adaptation. ANSWER OUTLINE: res/ holds non-code assets; create layout-port/ and layout-land/ with identical XML filenames for automatic framework selection.

What is the difference between project-level and module-level build.gradle?
Android & Kotlin2 min read

What is the difference between project-level and module-level build.gradle?

WHAT IT TESTS: Gradle scope in multi-module Android projects. ANSWER OUTLINE: Project level sets plugin repos and shared versions; module level sets dependencies, build types, and flavors. RED FLAG: Claiming both files do the same thing or misplacing plugins.