Recall & Review
beginner
What is Dependency Injection (DI) in Android development?
Dependency Injection is a way to provide objects that a class needs (its dependencies) from outside, instead of creating them inside the class. It helps make code easier to test and maintain.Click to reveal answer
beginner
What is Hilt in Android development?
Hilt is a library built on top of Dagger that simplifies dependency injection in Android apps. It provides standard components and annotations to reduce boilerplate code.
Click to reveal answer
beginner
What annotation do you use to tell Hilt to provide a class as a dependency?You use the @Inject annotation on the constructor of the class you want Hilt to provide as a dependency.Click to reveal answer
intermediate
How do you make an Android Activity ready for Hilt injection?
You add the @AndroidEntryPoint annotation to the Activity class. This tells Hilt to generate the necessary code to inject dependencies into that Activity.
Click to reveal answer
intermediate
What is a Hilt Module and why do you need it?
A Hilt Module is a class annotated with @Module and @InstallIn that tells Hilt how to provide dependencies that you cannot annotate with @Inject, like interfaces or third-party classes.Click to reveal answer
Which annotation marks a class constructor for Hilt to provide its instances?
✗ Incorrect
The @Inject annotation on a constructor tells Hilt how to create instances of that class.
What annotation do you use on an Android Activity to enable Hilt injection?
✗ Incorrect
The @AndroidEntryPoint annotation is used on Activities, Fragments, and other Android classes to enable Hilt injection.
If you want to provide a third-party library instance with Hilt, what should you create?
✗ Incorrect
You create a Hilt Module with @Provides functions to tell Hilt how to provide instances of classes you cannot modify.
What scope annotation would you use to make a dependency live as long as the application?
✗ Incorrect
The @Singleton annotation makes the dependency live as long as the application.
Which Hilt annotation specifies where a Module should be installed?
✗ Incorrect
The @InstallIn annotation tells Hilt which component the Module belongs to, like SingletonComponent or ActivityComponent.
Explain how Hilt simplifies dependency injection in an Android app.
Think about how Hilt manages dependencies and Android classes with simple annotations.
You got /4 concepts.
Describe the steps to inject a dependency into an Android Activity using Hilt.
Focus on annotations and how Hilt connects dependencies to Android components.
You got /4 concepts.