I feel like they are hypocrites, they say don't use static, but this hilt thing is basically static fields that live somewhere.
@tejshah62252 жыл бұрын
@condingWithMitch, I have created my one helper class which inject It and i have 2 activity. both activity have a different have new object allocation. Means it create a new object every time. why?
@thesoftwareengineer_4 жыл бұрын
Thanks Mitch .... This is very helpful
@Tech-To-Logic4 жыл бұрын
Hi Mitch, tell me one thing. Suppose we have 2 activity. And I declared a component as an @ActivityComponent and inject on both activity. Now if I switched to one activity to another, then how destruction of that injected component will happen?
@codingwithmitch4 жыл бұрын
This is what I'm not clear on. a) Is there an ActivityComponent generated for every activity in the project? b) Or is there a single ActivityComponent that lives as long as there is at least one activity alive I'm leaning heavily towards "b". I don't think it makes sense if you consider scoping. So Probably: 1) ApplicationComponent lives as long as app is alive 2) ActivityRetainedComponent lives as long as there is at least one viewmodel alive 3) ActivityComponent lives as long as there is at least one activity alive 4) FragmentComponent.... etc... I couldn't find anywhere in the docs that explained this in detail.
@Zhuinden4 жыл бұрын
@@codingwithmitch There is an ApplicationComponent that is global. There is an ActivityComponent configured globally, but instance created per each Activity. There is an ActivityRetainedComponent configured globally, but instance created per each Activity (that then places the component into a ViewModel and retrieves it from there if it already exists). There is a FragmentComponent that is configured globally, but instance created per each Activity. There is a hierarchy of Application -> ActivityRetained -> Activity -> Fragment.
@codingwithmitch4 жыл бұрын
@@Zhuinden So @FragmentScoped'd dependencies injected in "FragmentA" will live as long as ActivityA? And dependencies injected in "FragmentB" will live as long as ActivityB? Assuming FragmentA is a child of ActivityA and FragmentB is a child of ActivityB exclusively? BTW how you know this? Experimentation? Because I did not see this explained in the docs.
@Zhuinden4 жыл бұрын
@@codingwithmitch A combination of Manuel Vivo's Twitter, the generated source code of CustomApplication_HiltComponents.FragmentC, and the source code of Hilt_MainActivity, ActivityComponentManager, and Hilt_SomeFragment and FragmentComponentManager. I haven't read all of the docs, it's kinda long :D
@Zhuinden4 жыл бұрын
The tricky thing I don't really get yet is how custom EntryPoints work.
@Hackaprende3 жыл бұрын
Thanks a lot! What happens if we use always Singleton Scope? Are we going to have performance issues?
@bhuvneshvarma78433 жыл бұрын
@CodingWithMitch Thanks for such great tutorials..As per your tutorial "Activity Retain Scope gives same scope as View Model- more than activity but due before application die".I don't understand How you assumed that ViewModel lives more than Activity??Bcoz as per docs "ViewModel objects are scoped to the Lifecycle passed to the ViewModelProvider when getting the ViewModel. The ViewModel remains in memory until the Lifecycle it's scoped to goes away permanently: in the case of an activity, when it finishes, while in the case of a fragment, when it's detached."
@MohamedElnady0014 жыл бұрын
الحب كله يالا Translation: thank you very much
@mohamadsh38743 жыл бұрын
بتغلط ليه يسطا
@RonnieOtieno3 жыл бұрын
Dagger also throw runtime error, example is if you inject fragment and annotate it with Singleton. You will get an error that dagger doesn't support retained fragment instances or something like that
@matt-g-recovers3 жыл бұрын
Ok, now I get it.
@gunjotsingh36382 жыл бұрын
Loved it 🙌🏻
@PeteStMartin2 жыл бұрын
Engagement!
@yasserahmed34523 жыл бұрын
hi mitch, can you tell me if hilt is better or Kodein to use in di ? and thank you
@oscarperry6414 жыл бұрын
pioneer
@codingwithmitch4 жыл бұрын
😘
@learnwithmicrostar3 жыл бұрын
Thank you BRO for the great tutorial !
@ChrisAthanas3 жыл бұрын
Engage warp engines to 100k
@eddiej2043 жыл бұрын
By the Field injection approach, without define Scope, which component that the instance will be installed in?
@bhuvneshvarma78433 жыл бұрын
By default all bindings of hilt are unscoped.That means that each time your app requests the binding Hilt creates a new instance of needed type