Skip to main content
InterviewHubPRO
Section Overview
Q38

Question 38 of 50

Part 3: ART Internals, Memory Leak Profiling & Production Hardening (25 - 35)

76%
Android & Jetpack Compose (50 Qs)•Part 3: ART Internals, Memory Leak Profiling & Production Hardening (25 - 35)

Dependency Injection with Hilt / Dagger: Scopes, Component Lifecycles, and `@HiltViewModel`.

senior LevelMost AskedDependency InjectionComponentsLifecycle

In Simple Words: Hilt simplifies Dagger on Android by providing standard, pre-defined dependency scopes tied directly to Android OS component lifecycles:

  • @Singleton: Survives the entire application lifetime (SingletonComponent).
  • @ActivityRetainedScoped: Survives configuration changes (screen rotations) alongside ViewModels.
  • @ActivityScoped: Destroyed when the Activity is destroyed.
  • @HiltViewModel: Injects repositories, use-cases, and SavedStateHandle directly into ViewModels with zero factory boilerplate.