Join Chiu-Ki Chan for an in-depth discussion in this video Use Dagger in application, part of Advanced Android Espresso Testing.
- [Narrator] Let's use the application component…in the greeting application.…Open Greeting Application.…Instead of providing a clock,…we are going to have a component.…Delete Line 6, and type val component.…It will be of the type Application Component.…We are going to initialize it by lazy…and, inside the body, we are going to build…a Dagger Application Component.…
Dagger Application Component dot builder.…Next, we will provide a clock module.…Dot Clock Module and then give it Clock module.…Finally, we will call dot build.…Right now, on Line 8,…there is a strike through on Clock Module.…This is because we are not actually calling inject yet…so Dagger is smart enough to know…that it doesn't need a clock module.…
That will go away once we change our main activity.…Let's do that now.…Open Main Activity.…Notice on Line 14, we don't have…a provide clock function anymore on the application.…Instead, we are going to have a dagger component.…To use dagger for dependency injection,…we will use the at inject annotation.…On Line 9, we are going to inject a clock.…
- Incoming and outgoing intents
- How intents are used
- Dependency injection
- Why extract dependencies?
- Mockito and Dagger
Skill Level Advanced
Effective Android Testing for Mobile Developerswith Chiu-Ki Chan2h 56m Intermediate
Android App Development: Data Persistence Librarieswith Annyce Davis4h 52m Intermediate
2. Hermetic Test Environment
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.