You can simply inject the repository in the ViewModel constructor and can use the following line in the MainActivity: "val viewModel: MainViewModel by viewModels()" This will initialize the ViewModel in the MainActivity without using the ViewModelFactory. Hope you will find it useful! And no doubt, you are making awesome content. Explanations are exceptional. Love from Pakistan ❤
Hi, I have a doubt. When we created out app component class, @Singleton @Component(modules = [RetrofitBuilder::class]) interface ApplicationComponent { fun inject(myFragment: MyFragment) } We call inject method in our fragment/Activity. Same for every other fragments. Is there any way that we can call the inject method only in our application class & no need to explicitly call it in every activity/fragment?
@@CheezyCode YES, I understand. But is there any way to only initialize FakerAPI class once only in all our activities/fragments? Fagment1.inject Fragment2.inject So I do not have to write like above.
Great video. Just one doubt. Can we inject repository in ViewModel by using field injection? In this way, we won't need to create any factory for ViewModel. and we can call appcomponent.inject method in init function of ViewModel. Is it possible? Is there any downside to this?
Nice tutorial, clear and well explained. I just have a feeling that you may get a bit slow with your speaking. Sometimes It feels like playback speed at 1.25
Can you please provide full tutorial on mvvm, corutines, reterofit and hilt, as of now I see you created separate video for mvvm and dagger and with mvvm & hilt. thanku for all 🎥.
_ is private won't be accessible outside the class and it's mutable in nature - you can update the value within that class only Without underscore is public livedata - you can just read the value from it
Sir, I am following your course by developing a project in android studio. I am getting a different response in this API (502 Bad Gateway) and I am in the middle of developing the project. Could you please update API with the same response? Thank You 🙏
Awesome tutorial 😃 I have one question. Why we need to use MainViewModelFatory? can't we directly create MainViewModel object like below val viewModel: MainViewModel by viewModels() Or am I miss understood something?
If you have ViewModel that needs input parameters in constructor, you have to create factory by Viewmodels is just a shortcut - behind the scenes it does the same thing. Plus, this requires another extension library.
@@CheezyCode I thought Dagger will provide all objects, so viewModels() will be easy to use. but I don't know it's requires another extension library. So thanks for your reply.
1. ViewModel pe function banao 2. Function mei parameters pass karo 3. Iss function ko activity se call karlo 4. ViewModel pe data aagya ..repo ka function call karalo
@@CheezyCode very very much thank you sir for reply sir vo function hi call nahi ho raha sir aapne bahut sare video banaye h please sir meri ye problem bhi resolve kara dijiye sir please
bhaiya jab mai kise or api ko hit karta hu tu yeh problem aati hai ... expected begin_array but was begin_object at line 1 column 2 path $ iska kya solution hai ?
Yes we can use...I didn't have flows related videos on my channel back then so used livedata. Flows series is going to be started soon. Stay tuned for that.
Its simple but very robust way of dealing with complexities. Great tutorial
Thanks Anil
best explanation .... I just shifted from MVP to MVVM ... :)
Sir You Explain Rocket Science Logic in Simple Words💗💗💗
Superb Explanation !!! Your tutorial help me to grip Dagger very easily.
Thank you for the complete tutorial on Dagger. Your playlist helped a lot.
Best tutorial for android development in india good explation thanks a lot
😊👌
Thanks a ton
Great explanation. Simple, Understandable..
Best tutorial, very informative.
You can simply inject the repository in the ViewModel constructor and can use the following line in the MainActivity:
"val viewModel: MainViewModel by viewModels()"
This will initialize the ViewModel in the MainActivity without using the ViewModelFactory.
Hope you will find it useful!
And no doubt, you are making awesome content. Explanations are exceptional.
Love from Pakistan ❤
Love from India ❤️
Your explanation is next level... thanks for sharing your knowledge
Thanks and welcome
Very Good.kindly upload some video regrading some Android app security concept.
superb explanation sir
Thank you for sharing information's
Great and helpful tutorial
great explanation
Cheers...♥
Nice tutorial, clear and well explained.
But please provide dagger-hilt tutorial as well
Will do for sure
Awesome sir...after dagger series ends, please start with threads looper handlers as well as rx java
Noted...let's see
Great video sir
Keep going 💪
🤘
Awesome sir thank you so much 😊
🤘
Hi,
I have a doubt.
When we created out app component class,
@Singleton
@Component(modules = [RetrofitBuilder::class])
interface ApplicationComponent {
fun inject(myFragment: MyFragment)
}
We call inject method in our fragment/Activity. Same for every other fragments. Is there any way that we can call the inject method only in our application class & no need to explicitly call it in every activity/fragment?
Bina class access kiye properties mei value assign kaise hogi?
@@CheezyCode YES, I understand. But is there any way to only initialize FakerAPI class once only in all our activities/fragments?
Fagment1.inject
Fragment2.inject
So I do not have to write like above.
@@ShriwastavaAbhishek generic fragment.inject, will allow field injection
no, @Inject won't be there.. in generic, wrong socha tha
Great video. Just one doubt. Can we inject repository in ViewModel by using field injection? In this way, we won't need to create any factory for ViewModel. and we can call appcomponent.inject method in init function of ViewModel. Is it possible? Is there any downside to this?
Great video! Grateful!
Thanks Aakash
Nice tutorial, clear and well explained. I just have a feeling that you may get a bit slow with your speaking. Sometimes It feels like playback speed at 1.25
Dilemma.....
Please implement payment integration and google map and polyline using kotline
Helpful videos sir
Thanks Tinku
Can you please provide full tutorial on mvvm, corutines, reterofit and hilt, as of now I see you created separate video for mvvm and dagger and with mvvm & hilt. thanku for all 🎥.
Converted this project to HILT in this video -ruclips.net/video/NqiqsRiMT1Q/видео.html
Will try to create full tutorial with different API
Thanks for the video
🤘
sir could you make a video on baseActivity and baseFragment classess?
why to create 2 live data one with underscore and one without underscore can you please help to understand this ?
_ is private won't be accessible outside the class and it's mutable in nature - you can update the value within that class only
Without underscore is public livedata - you can just read the value from it
Sir, I am following your course by developing a project in android studio. I am getting a different response in this API (502 Bad Gateway) and I am in the middle of developing the project. Could you please update API with the same response? Thank You 🙏
Api toh third party hai bro...no control over it...
@@CheezyCode okay Sir I will try different one.
@@CheezyCode It is working now I think it has some limit over requests.
How do do field injection in repository or viewModels.
Awesome tutorial 😃
I have one question.
Why we need to use MainViewModelFatory?
can't we directly create MainViewModel object like below
val viewModel: MainViewModel by viewModels()
Or am I miss understood something?
If you have ViewModel that needs input parameters in constructor, you have to create factory
by Viewmodels is just a shortcut - behind the scenes it does the same thing. Plus, this requires another extension library.
@@CheezyCode I thought Dagger will provide all objects, so viewModels() will be easy to use.
but I don't know it's requires another extension library.
So thanks for your reply.
Sir activity se viewmodel me data kaise pass krte h multiple edit text h and repository me kaise api lagegi please sir video
1. ViewModel pe function banao
2. Function mei parameters pass karo
3. Iss function ko activity se call karlo
4. ViewModel pe data aagya ..repo ka function call karalo
@@CheezyCode very very much thank you sir for reply sir vo function hi call nahi ho raha sir aapne bahut sare video banaye h please sir meri ye problem bhi resolve kara dijiye sir please
DaggerApplicationComponent is unresolved reference, tried rebuild adding all required dependencies plz help
What's the error?
@@CheezyCode dagger is not generating component after rebuild
bhaiya jab mai kise or api ko hit karta hu tu yeh problem aati hai ...
expected begin_array but was begin_object at line 1 column 2 path $
iska kya solution hai ?
Response mei type galat pass ho rha h...array vs object aa rha h...peeche se shayad object aa rha h aap array bana rahe ho
Thumbnail 👌
Cheers 😊
How to call multiple api using MVVM architecture
Should we create seperate Factory class for each my VM , aur we should create one Generic Factory class for all my viewmodel sir ? @CheezyCode
separate
deps is distinct to each vm, so also separate..
What to do with multiple view models?
??
ViewModel toh honge he multiple....
Repository should not contain android components, we can use flows instead ?
Yes we can use...I didn't have flows related videos on my channel back then so used livedata. Flows series is going to be started soon. Stay tuned for that.
One more thing - it is ok to use livedata if we are not doing any heavy transformation on the data but flows are recommended now.
@@CheezyCode Great... looking fwd to flows series.
why we not add factory in module
🤔
hilt is much better i think
Better is subjective 🙂
@@CheezyCode yes sir by your videos i learnt behind the scenes