Created
December 1, 2017 14:43
-
-
Save larkintuckerllc/ec7ce9013338d2400219067580708c30 to your computer and use it in GitHub Desktop.
How-to Dagger 2 with Android: Part 3 - 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
public class MyApplication extends Application { | |
static private AppComponent sAppComponent; | |
static private AuthComponent sAuthComponent; | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
sAppComponent = DaggerAppComponent.create(); | |
} | |
static public AuthComponent plusAuthComponent() { | |
if (sAuthComponent == null) { | |
sAuthComponent = sAppComponent.plusAuthComponent(); | |
} | |
return sAuthComponent; | |
} | |
static public void clearAuthComponent() { | |
sAuthComponent = null; | |
} | |
static public AppComponent getAppComponent() { | |
return sAppComponent; | |
} | |
static public AuthComponent getAuthComponent() { return sAuthComponent; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment