android - Value injected with dagger is null -


I'm new to dagger and I'm trying to study it about making Android apps and making small Android apps I am I have an application class like this:

  Expands the class app application {@Override onCreate () {super.onCreate (); Object Graph objectGraph = ObjectGraph Siquette (new app module (this)); ObjectGraph.inject (this); }}   

and thus module:

  @Dagger Modules (injects = {App.class, MainActivity.class}) Public class AppModule {Private app app; Public app module (app app) {this.app = app; } Provide @Signaton app (app) {return app; }}   

More activity in which the app is injected:

  expanding the MainActivity activity of the public class {@ Inject app app; @ Override on Crate (Bundle Saved InstantState) {Super. NET (Saved Instantstate); SetContentView (R.layout.activity_main); If (app == empty) toast. Make Text (this is, "App is empty", 1000). Show (); }}   

My app is specified in the Manifest file and breakpoints starts int App.onCreate () .

Am I missing something? Can anyone tell me why this is empty? Thank you.

Your 'main activity' needs to call ObjectGraft # injection method that you created in your application. Went.

You can see it: or it

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -