I just want to tell you that you saved me from further stress today. Been having a problem with a parent fragment and its child fragment that are supposed to share one viewmodel. The key was "activityViewModels". Thanks for explaining what it's for!
@StevdzaSan2 жыл бұрын
Happy to help with the stress! 😎
@bharathprakash Жыл бұрын
Sir thank you so much !! Clear explanation Lot's of love from India ❤
@AmitJayant2 жыл бұрын
Very precisely explained. Thanks a lot for this. ❤️ From India
@mwahajsajidali579910 ай бұрын
Thanks man, I am learning android development, and I am working on a project which uses the concepts of navigation. I wanted to retrieve data from 1st Fragment. I tried everything like I tried data Classes to save data from 1st Fragment and use it in the 2nd Fragment but it did'nt work. Then, I realized that there must be another way of communication between two Fragments. Thank You very much for this information.
@herisarwanto11833 жыл бұрын
Nice. Easy to understand, and well explain too
@StevdzaSan3 жыл бұрын
Glad to hear that 💜
@tylerryden Жыл бұрын
Thank you! Simple, straight to the point, and now I have a great understanding as to how to share data between fragments tied to the same activity.
@tadiyal043 жыл бұрын
No words for your tutorial . u hit the bull eye
@batuhans.51205 ай бұрын
Very simple and giving good inspiration thanks for well education
@irvingj.villanueva23182 жыл бұрын
Just what i needed and explianed in a clear way
@nima7605 Жыл бұрын
U have the best profile picture ever 🤣, Also thx for the Great videos
@mobbs8229 Жыл бұрын
Stevzda, thank you so much, man. Your tutorials are just so on point.
@imadbouhafer62892 жыл бұрын
solved my 15days struggle thnx bro
@StevdzaSan2 жыл бұрын
Happy to help! 🙌
@shafique7z2 жыл бұрын
Man!!! I was running crazy after this! You explained well you showed an example well! you just earned a sub
@StevdzaSan2 жыл бұрын
Yay 🙌
@ericgacoki22253 жыл бұрын
Smart content and creative animations ❤️. We're still waiting for the Jetpack Compose 🚀 series.
@kamandemwangi Жыл бұрын
Thank you man. I was having trouble navigating between fragments as my viewmodel was scoped to fragments instead of the activity.
@subindsuresh48972 жыл бұрын
Thank you. Explanation was very clear.
@rajaarumugam2018 Жыл бұрын
Nice explanation..👍👏🥳
@samuelwakoli2 жыл бұрын
I like how you deliver your content. It's well understood. Thanks
@iftak013 жыл бұрын
Great video and example .. my fav one by you!
@StevdzaSan3 жыл бұрын
Thanks 💜
@007ayansinha3 жыл бұрын
useful, relevant and to the point
@ArjunVerma-lq4cf3 жыл бұрын
great explanation simple and short
@miguellugodev3 жыл бұрын
Excellent is what i was looking for!!
@parveensharma22703 жыл бұрын
Nice tutorial.....good work
@muhammadfitrie70612 жыл бұрын
Tq so much, as usual, very helpful
@sushmoyr3 жыл бұрын
So, like fragments, can we use sharedViewModel in activities?
@rahmaditha44353 жыл бұрын
i have the same question as well
@MrThejaswi3 жыл бұрын
Technically you can by creating a custom view model factory class and returning the same instance. But this is not recommended because it defeats the purpose of view model otherwise
@iammind38883 жыл бұрын
Awsome brother thanks for this important video
@easybusinessou3 жыл бұрын
Amazing I always waiting for you vedio
@anudeepananth3 жыл бұрын
Can you please do a video on how we could save the recycler view scroll positions used in fragments using the shared shared ViewModel... As of now I m hiding and showing fragments while navigating which is not an elegant solution
@odtuludenyazilim10 ай бұрын
Thank you sooooooooo much bro.
@mkc0321 Жыл бұрын
awesome video, you saved me
@faboxbkn2 жыл бұрын
amazing! nicely explained
@StevdzaSan2 жыл бұрын
Thanks 👍
@easybusinessou3 жыл бұрын
I love your vedio please keep on..... 😍😍😍🙏
@amangour45085 ай бұрын
@stevdza-San , what if a viewModel is to be shared among different activities ? how to do that ?
@earth22013 жыл бұрын
Thank you but I have a question: Why did not you create view model in Activity? And, Can I create "some" diffrence view model for "some" difference fragment? Thanks again. Sorry my bad English.
@akndonut5131 Жыл бұрын
Can we use this method share an arraylist between fragments an activitys
@StevdzaSan Жыл бұрын
Sure
@akndonut5131 Жыл бұрын
@@StevdzaSan on my project there is a error while i wrote " private val sharedViewModel : SharedViewModel byactivityViewModels()". my pc do not recognise activityViewModels()
@coffeedude2 жыл бұрын
What do I do if I need to use a factory with the delegate activityViewModels?
@aliakkawi47593 жыл бұрын
Awesome tutorial
@kumar_rajesh_3 жыл бұрын
can you please post a video about dagger 2 implementation it would be very helpful
@appranger66393 жыл бұрын
One question: Can I use different viewmodels for each fragmet on top of using a shared viewmodel???? Otherwise we will have to put all the business logics of all the fragments in that same shared viewmodel. What is the solution here???
@StevdzaSan3 жыл бұрын
Sure you can.
@appranger66393 жыл бұрын
@@StevdzaSan Thank you, I was searching for this the whole day and couldn't find an answer. Because the android documentation says that we should use only one viewmodel per activity/fragment. So you are telling me I can use two viewmodels for one fragment/activity in this case, right???
@tessanix9771 Жыл бұрын
That's a great video! But I would like to know how to do the same if I use Jetpack Compose since we do not use Fragments in Compose.
@StevdzaSan Жыл бұрын
Yeah ✅️
@tessanix9771 Жыл бұрын
@@StevdzaSan Ok but I'm only using composable so I don't have acces to "by activityViewModels()" in them. How coudl I do ?
@jayantkumar19543 жыл бұрын
It's amazing 💪💪
@Rafael-hk9pg2 жыл бұрын
Is this possible with Jetpack Compose? Thanks!
@StevdzaSan2 жыл бұрын
Yep
@05Sambist3 жыл бұрын
Can you make a video about how to save fragment state at bottom navigation with Navigation Graph?
@anudeepananth3 жыл бұрын
Yes I have the same request
@rickventura11093 жыл бұрын
Muito obrigado, me ajudou de mais.
@nugrohodaru95023 жыл бұрын
Nice video 👍
@StevdzaSan3 жыл бұрын
🙏🙌
@Revitalish6 ай бұрын
please make a video about shared viewmodel with nested navgraphs. there are no tutorials about it
@andrzejkurowski22933 жыл бұрын
You're a lifesaver!
@iJuce3 жыл бұрын
does Snapchat use viewpager with activities or fragments (when sliding between screens)
@sajjadabdulaziz61783 жыл бұрын
Thanks bro
@phadu10243 жыл бұрын
Where have u inflated layout with id I cannot see that?
@henriquepetters3 жыл бұрын
Might be stupid, but when to use vm factory? In this example you haven't used it.
@wahyukoco45622 жыл бұрын
i think it only be used if you need parameter in viewmodel
@deepakbisht7764 Жыл бұрын
@@wahyukoco4562 true but its better to use dependency injection. but you are right we use view model factory when we have some custom requirements and we need to do more stuffs than just creating a simple viewmodel
I am always sad when I see these kind of good videos because ViewModel, DataBinding and all cannot be done by me. Why because I don't have android studio I use AIDE it does not have the capability to do that
@hannanhub17173 жыл бұрын
then download android studio....
@cw3dv3 жыл бұрын
@@hannanhub1717 No computer I do android app development in an android device