Posts

Showing posts from July, 2019

Adventures in Dagger2 for Android

Adventures in Dagger2 for Android Adventures in Dagger2 for Android Introduction I’ve spent the last eight or so months working as an Android application developer and in that time I’ve managed to pickup a few handy tricks, none quite so helpful as Dagger2 . The purpose of this blog post is to document and share what I know about using the staple dependency injection library, and why it is useful. Before we get started, there are tons of great tutorials out there already and I will formally recommend That Missing Guide: How to use Dagger2 by Gabor Varadi and the official users guide maintained by Google . I first heard about Dagger when I was starting at a new job and, as so often is the case , I inherited an existing code base. The first question I had when I learned about Dagger: why ? Why Inject when I can build Lets consider a toy example to represent a party dip: public void entryPoint ( ) { ArrayList < String > ingredientList = new Arr