Home / Videos / Dolch 2 Tutorial Teil 4 – METHODE EINSPRITZEN – Android Studio Tutorial

Dolch 2 Tutorial Teil 4 – METHODE EINSPRITZEN – Android Studio Tutorial



In Teil 4 des Dagger 2-Tutorials lernen wir, wie man Methodeninjektionen macht. Durch Annotieren einer nicht-privaten Methode mit @Inject weisen wir Dagger an, sie als Teil des Injektionsprozesses aufzurufen und ihre Argumente als Abhängigkeiten anzugeben. In Kombination mit der Konstruktorinjektion geschieht dies automatisch, nachdem der Konstruktor fertig ist. Ohne Konstruktorinjektion geschieht dies, wenn die Methode zum Injizieren von Elementen für die Komponente aufgerufen wird. In beiden Fällen wird die Methode (oder die Methoden) aufgerufen, nachdem alle mit @Inject-Anmerkungen versehenen Felder eingefügt wurden.
Ein Anwendungsfall für die Methodeninjektion ist, wenn wir das vollständig konstruierte Objekt selbst mit "this" an die Abhängigkeit übergeben möchten, damit es nicht aus dem Konstruktor entweicht.

Sehen Sie sich die gesamte Playlist an:

Beispielcode + Abhängigkeiten:

____________________
❗ Abonniere den Kanal:

⏯ Weitere Tutorials ansehen:

㊙ Hilf beim Übersetzen der Videos:

💚 Unterstütze den Inhalt:
 

💬 Am Discord-Chat teilnehmen:

🎧 Hörbücher und Podcasts für Programmierer:
 

👶 So fangen Sie mit der Android-Entwicklung an:
 

📣 Folgen Sie Coding in Flow in den sozialen Medien:

Facebook:

Instagram:

Twitter:

Blog:
  .

About AndroidWeltEditor

Check Also

Google Developer Student Club 2019 – Muhammad Alan Nur (Politeknik Elektronika Negeri Surabaya)

Hallo Leute, ich bin Muhammad Alan Nur als Vertreter von Google Developer Student Lead PENS …

37 comments

  1. I am really surprised to see that this guy replies to every comment.
    Kudos🙌🙌

  2. Passing the injected object to the dependency, or in this case pass the car object (the dependency of MainActivity) as an argument somewhere in the Car class' code. This is necessary because this injection has to happen afterr constructors have finished.

    Order of execution of injection: constructor, field, method. Field and method injection only happen automatically if we also do constructor injection. Otherwise we have to use the components' inject method (basically triggering injection manually).

  3. thank you your tutorial, god bless you!

  4. Thank bro you help me too much :))

  5. Thanks for the series, quick question, why are we passing Car object as an argument of the setListener() method?

  6. Awesome explanation. I had a few doubts about the need for explicitly calling the inject(Activity activity) after the second video, but this video made it clear. Thanks for such amazing content.

  7. By annotating a non-private method with @Inject, we tell Dagger to call it as part of the injection process and provide its arguments as dependencies.

    In combination with constructor injection, this happens automatically after the constructor finished. ok

    Without constructor injection, it happens when the members-injection method is called on the component. ?????

    i think we do inject manually.

    In both cases, the method (or methods) is called after all @Inject annotated fields are injected. ok

    A use case for method injection is if we want to pass the fully constructed object itself to the dependency with "this", so we don't let it escape from the constructor. ok

  8. key element we don't need to call @ inject in MainActivity, dagger do it for us.
    more i watch more i got new stuff!!

  9. Dagger need constructor injection class off all the class?

  10. you are a dude bro ! awesome work

  11. Great tutorial bro! In your video you said that we would not to combine the three way (constructor, field, method), can you please tell me more the reason about this? Or anyone can?

  12. I got it after watching your serial video
    but it's hard for me to practice it in my project now. 🙁

  13. I finally know what Dagger is but isn't dagger inflating the code ?! seems so

  14. thanks you are so good at teaching

  15. Amazing content. Do you have a schedule for your next video on the same topic (Dagger2) ? I believe there's going to be an episode of dagger.android. 🙂 Good work brother. Keep it up!

  16. Thanks you made understand Dagger easily! keep going.

  17. Sir make a video on to subtract two time values by timepickers on button

  18. i understand your pronunciation , i like the way you teach, i will follow all of your video ( subscribed )

  19. Will you explain some more about Dagger like @Provides, @Modules, @Scope etc or this is last video?

    If possible please implement Dagger2 in a small application, because every time I try to implement it in my realtime app. I mess up. And I'm sure this is the story with others also.

    Thank you.

  20. Florian can you please make a video on how to use the profiler in android studio??

  21. Are you making any architecture component tutorials for Firestore? Firestore has offline caching so a room database isn't needed.

  22. hey, so this is random but can you create a payment method tutorial? if you could that would be awesome thank you so much!

  23. one of the most clean tutorial over dagger 2 , thank you sir for making such wonderful tutorial.

  24. Nice…Was waiting for this to come.

  25. Please make a small app showing the use of dependency injection.

    And if u find time plase make a video on cashing i.e chasing data form network and keeping it in database. Use retrofit and room

  26. I always wait for your videos… Thank you for such informative videos

  27. Awesome brother, I am from bangladesh. Please make a video above Pinch to text zoom.Thanks.

  28. Thank you, can't wait for the next parts 🙂

  29. Thanks bro 💖 I'm waiting this video from three days

  30. Sir make a video on
    How an app screen will display if phone is lock

  31. I m waiting ur vidos always

Leave a Reply

Your email address will not be published. Required fields are marked *