Android Interview Questions
3 min readJul 15, 2023
Kotlin
- What is the difference between
const val
andval
? - What is so interesting about
data class
? - Is singleton thread-safe? vs Object?
- What are different type of scope modifiers?
- What are different Coroutine Scope?
- How to manage series and parallel execution?
- Difference between Flow/SharedFlow/StateFlow and elaborate it.
- What happens if we call
.cancel()
from a coroutine scope? - What is an Init block in Kotlin?
- How to choose between apply and with?
- What is inline function in Kotlin?
- Difference between Coroutine and Java Thread
- Why Coroutines are light weight?
- How does Coroutine switch context?
- How does extension functions work?
- @JvmStatic , static and Companion object
- Kotlin vs Java
- Parcelable vs Serializable
Android
- How does Garbage collection works?
- What is a dangling pointer?
- Elaborate Memory Leak?
- Explain fragment Lifecycle when it comes to ViewPager and sliding between different fragments.
- Difference between FragmentStateAdapter and FragmentStatePagerAdapter.
- Difference between Serializable and Parcelable? What are the disadvantages of Serializable?
- How you could implement observable SharedPrefs or observable Databases i.e. Observe a certain key/table/query?
- How does layout inflation work from xml tags to view reference in memory?
- What is a Thread, Handler, Looper and Message Queue?
- What are the different methods of concurrency on Android? Can you explain the difference between ExecutorService vs CachedThreadPool vs FixedThreadPool vs AsyncTasks vs HandlerThreads?
- How does
ViewModel
instance provided to Activity and Fragment. How doesViewModelProviderStore
decide when to retain the instance? - How do you inspect and solve Jank issue? here
- How does the OutOfMemory happens?
- How do you find memory leaks in Android applications?
- What is Doze? What about App Standby?
- What does
setContentView
do? - Process of creating a custom view
- Deeplink understanding and architecture
- Notifications
Lifecycle
- How to keep a video maintain playing state when we rotate screen?
- How many callbacks in Fragmnets?
- What could be the reasons when
onPause
didn't get triggered? - What kind of events trigger
onPause()
to run? - In what scenario does the “onDestory” get called directly after “onCreate”?
- Which callback gets called on Activity when an AlertDialog is shown?
- What’s the lifecycle in PIP (Picture-in-Picture)?
- What happens if you rotate the device?
- Inside a viewpager (Fragment state pager adapter) what will be the lifecycle of the fragments when you swap from tab to another ?
- Why onActivityCreated is now depreciated in Fragment?
- Which callback should i use if i want to know when my activity came to foreground?
- When is onActivityResult called?
- What does setRetainInstance do and how you can avoid it?
- What callbacks trigger when a Dialog opens up? Conside both case, dialog attached from same activity/fragment and other activity/fragment.
- What does
launchWhenCreated
,launchWhenStarted
, andlaunchWhenResumed
functions do?
Thread
- Different type of threads?
- Difference between different type of thread?
- Thread <-> Handler <-> looper
- UI vs Background Thread
Architecture
- What is SOLID principles?
- What is MVVM?
- Brief about Android Architecture.
- How ViewModel retains the data in screen orientation?
- MVVM , MVI, MVC, MVP difference
- Design Patterns
Libraries
- How Glide internally works?
- Hoe does retrofit workss internally?
- ViewModel internal working
- Proguard Working and Use
Common Question
String
vsStringBuilder
==
vs.equals
?===
vs==
?- Java OOP concepts
- val vs const
- inline keyword
- lateinit vs lazy
- fragments & their lifecycle, Activity lifecycle, Views, Layouts