Q1
Describe the lifecycle of an Android Activity and explain how you would handle state preservation during configuration changes. What are the trade-offs between using ViewModel, onSaveInstanceState, and retained fragments?
Why they ask this:* They're testing your deep understanding of Android fundamentals and your ability to choose appropriate solutions for preserving UI state in real-world applications.
Q2
Explain the difference between LiveData and StateFlow. In what scenarios would you use one over the other, and how does each interact with Kotlin coroutines?
Why they ask this:* They want to assess your knowledge of modern Android architecture patterns and whether you understand reactive programming paradigms currently used in the industry.
Q3
Walk us through how you would implement dependency injection in an Android project. Compare constructor injection, setter injection, and using a DI framework like Hilt—what are the pros and cons of each?
Why they ask this:* This tests your understanding of software design principles, testability, and whether you can architect scalable, maintainable code at a mid-level perspective.
Q4
How would you optimize memory usage in an Android app that loads and displays high-resolution images? Discuss caching strategies, image compression, and tools you would use to identify memory leaks.