Last active
February 4, 2018 17:13
-
-
Save mohsenoid/5c8378bc503dba0c5457d86d4d26ebff to your computer and use it in GitHub Desktop.
Sample Application class https://hackernoon.com/yet-another-mvp-article-part-2-how-dagger-helps-with-the-project-90d049a45e00
This file contains hidden or 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
package com.mirhoseini.marvel; | |
import android.app.Application; | |
public abstract class MarvelApplication extends Application { | |
private static ApplicationComponent component; | |
public static ApplicationComponent getComponent() { | |
return component; | |
} | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
initApplication(); | |
component = createComponent(); | |
} | |
public ApplicationComponent createComponent() { | |
return DaggerApplicationComponent.builder() | |
.androidModule(new AndroidModule(this)) | |
.build(); | |
} | |
public abstract void initApplication(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment