🎯 Android Interview Cheat Sheet - Staff/Senior Mobile Engineer

Core Android

Activity Lifecycle: onCreate → onStart → onResume → onPause → onStop → onDestroy

4 Components: Activities, Services, Broadcast Receivers, Content Providers

Parcelable vs Serializable: Parcelable faster (Android-optimized), Serializable easier (reflection)

Coroutines: Lightweight threads, structured concurrency. Use viewModelScope.launch

Flow vs LiveData: Flow = cold stream, rich operators. LiveData = hot, lifecycle-aware

Memory Leaks: Avoid static Activity refs, clear listeners, use lifecycle-aware components

MVVM Architecture

Flow: View (UI) → ViewModel (logic) → Model (data)
• View observes ViewModel via StateFlow/LiveData
• ViewModel never references View
• Repository = single source of truth
class UserViewModel(repo: UserRepository) { private val _state = MutableStateFlow(Loading) val state = _state.asStateFlow() fun load(id: String) = viewModelScope.launch { _state.value = try { Success(repo.getUser(id)) } catch(e: Exception) { Error(e) } } }

Clean Architecture

Layers: Presentation → Domain → Data
Rule: Outer depends on inner, never reverse

• Presentation: UI, ViewModel
• Domain: UseCases, Business Logic
• Data: Repository, API, DB

Repository Pattern

class UserRepo(api: Api, dao: Dao) { suspend fun getUser(id: String): User { dao.getUser(id)?.let { return it } val user = api.getUser(id) dao.insert(user) return user } }

Dependency Injection

Benefits: Testability, decoupling, flexibility

Hilt: @HiltViewModel, @Inject constructor, @Module, @Singleton

Kotlin Multiplatform (KMP)

Share: Business logic, repos, models, network, DB (60-80%)
Platform: UI (Compose/SwiftUI), platform APIs

6 Key Advantages

1. Code Reuse - Write once, run everywhere
2. Type Safety - Shared models, compile-time checks
3. Gradual Adoption - Incremental integration
4. Native Performance - No bridge overhead
5. Native UI - Real Compose/SwiftUI
6. Single Team - Devs work on both platforms

Expect/Actual Pattern

// Common expect class Platform() { val name: String } // Android actual class Platform { actual val name = "Android" } // iOS actual class Platform { actual val name = "iOS" }

Architecture

Platform UI → Domain (Shared) → Data (Shared: Ktor, SQLDelight)

Libraries

Network: Ktor   DB: SQLDelight, Realm
Serialization: kotlinx.serialization   DI: Koin

KMP vs Flutter vs React Native

Feature KMP Flutter RN
Language Kotlin Dart JavaScript
UI Native Custom Native
Performance Native Near-native Bridge
Code Share 60-80% 100% 70-90%
Best For Kotlin teams New apps JS teams

Multi-Module Architecture

Benefits: Faster builds, clear boundaries, better testing

Structure: app → feature-modules → core-modules

Performance Optimization

Startup: Lazy init, StrictMode, App Startup library

Runtime: Lazy loading, efficient RecyclerView, Coil, baseline profiles

Build: Gradle cache, R8/ProGuard, parallel builds, modularization

Monitoring: Firebase Performance, custom metrics, crash reporting

Technical Leadership

Staff Engineer Responsibilities

• Architecture: Define patterns, tools, systems
• Mentorship: Code reviews, tech talks, pair programming
• Quality: Best practices, testing, CI/CD
• Impact: Force multiplier - good abstraction > 10 fixes

Code Review Best Practices

• Constructive feedback, explain "why"
• Share learning resources
• Focus on architecture, not syntax
• Encourage discussion

Documentation

ADRs, coding guidelines, API docs, onboarding guides

Interview Tips

Technical Questions

Think aloud, ask clarifying questions, explain trade-offs, mention alternatives

STAR Method (Behavioral)

Situation → Task → Action → Result

Good Questions to Ask

• "What's the biggest technical challenge?"
• "How balance velocity with quality?"
• "Success in first 6 months?"
• "How handle technical debt?"
• "Testing strategy and CI/CD setup?"

Red Flags to Avoid

• "I don't know" without reasoning
• Criticizing employers/teammates
• Being dogmatic about tech
• Not asking questions
• Making things up when unsure

Quick Reference

Design Patterns: Singleton, Factory, Observer, Strategy, Repository

Testing: Unit (MockK, JUnit), Integration, UI (Espresso, Compose), Screenshot (Paparazzi)

CI/CD: Gradle, GitHub Actions, GitLab CI, Bitrise, Fastlane, Detekt/Lint