Android

Android Dependency Injection

Dependency Injection with Hilt and Dagger: @Inject, @Module, @Provides, Scopes, Qualifiers, Testing

15 câu hỏi phỏng vấn·
Mid-Level
1

What is Dependency Injection (DI)?

Câu trả lời

Dependency Injection is a pattern that provides a class's dependencies from the outside rather than creating them inside. This improves testability, modularity and reduces coupling between components.

2

What is Hilt?

Câu trả lời

Hilt is a DI library built on top of Dagger 2, specifically designed for Android. It simplifies DI configuration with standard annotations and automatically manages Android components (Activities, Fragments, ViewModels).

3

What is the @HiltAndroidApp annotation used for?

Câu trả lời

@HiltAndroidApp is applied on the Application class and triggers Hilt code generation. It creates the application root component and enables dependency injection throughout the app. Required to use Hilt.

4

What is the @AndroidEntryPoint annotation used for?

5

What is the @Inject annotation used for?

+12 câu hỏi phỏng vấn

Nắm vững Android cho lần phỏng vấn tiếp theo

Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.

Bắt đầu miễn phí