Back to project page mvp-notes.
The source code is released under:
Apache License
If you think the Android project mvp-notes listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.corneliudascalu.mvpnotes.common; /*from w w w. java 2 s . com*/ import android.app.Activity; import android.os.Bundle; import dagger.ObjectGraph; import java.util.List; /** * Base class for all activities, which creates a scoped object graph and injects is in the activity. Extended * classes will implement the {@link #getModules()} method to specify the needed modules * * @author Corneliu Dascalu <corneliu.dascalu@gmail.com> */ public abstract class BaseInjectedActivity extends Activity { private ObjectGraph objectGraph; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); objectGraph = ObjectGraphHolder.createScopedObjectGraph(getApplication(), getModules().toArray()); objectGraph.inject(this); } protected abstract List<Object> getModules(); @Override protected void onDestroy() { super.onDestroy(); objectGraph = null; } }