Sir, while having more than one Activity and using the MVVM pattern, where should I handle the startActivity() method? in Activity class or ViewModel class? is it good to pass context to ViewModel? Or can I use the navigation component for Activities also?
Thanks a lot! I want to know the best way to handle a lot of navigations in MVVM pattern. Should we do on Fragment itself or we can somehow do it from viewmodel (Data binding)?
Navigation component m hi data kese send krenge sir wk se dusre fragment per or directiondemofragemny aisa object create nhi ho paa eha h mne bhut kosish krli
Navigation component recreates fragment after navigating from one to another fragment . Is it expected behaviour. I am seeing onCreateView if fragment called even on back stack . Is there any difference between using FragmentContainerView and fragments
Instead of adding the new fragment it's replaced, so the fragment view is destroyed, onDestroyView() is called and onCreateView() is called when back is pressed to recreate the view. Not sure why it recreates fragment always rather than replacing as we did with FragmentTrasanction
sir ek chiz btao , agar puri app mai only single activity use kre ham navigation graph use krke , or main screen mai after login or signup bottom nav ya drawer hoga to vo kha pe bnega jo activity hai vha pe ya new activity bnani pdegi ya fragment mai plz answer
Sir i have two question. Mere 3 screen hai. Phale splash screen fir login aur akhir me home. Mai splash screen har bar dikhata hun. Par mai home screen se sabhi jaga jata hun. To mera starting destination kya hoga. Splash screen ya fir home screen
Hi Sir, Thanks a log! for this amazing video. I have a query here regarding back stack in fragment. Suppose we start from loginFragment->mainFragment->noteFragment. If we navigate from noteFragment->loginFragment(might be by logout action) then how will work back stack in this case?. what mainFragament do exist in this case.
1. Main fragment pe jaise he pahochege toh backstack khali kar dege. Kyoki main fragment se back button pe login screen nahi aani chaiye 2. Now main se note pe jaate hai aur fir logout karte hai toh sab kuch pop kara denge... kyoki logout kiya hai... Ye cover karege - stay tuned for that. Waise just 2 aur properties hai - popUp and popUpToInclusive
sir fragment fast open hotay hin ya activity? mtlb agr hm 10 say 15 pages ki app bna rahay hin to fragment use krin to button click krnay pay fast load ho ga ya activity fast open ho gi?? 2nd hm admob k banner ads lgatay hin to agr ads activity k start main hi load krwa dain to button click krnay pay activity boht slow open hoti ha. because pahlay ads load hota ha and bad main activity ka function. to isay fast krnay k leyah keya krin???????
@@CheezyCode MainFragment has recyclerview having pagination now suppose I scrolled list so currently on 15th page if I click on item and go to DetailFragment and press back then MainFragment is reloaded due to replace and pagination start with page 1 so If we perform add operation then MainFragment will not be reloaded
Got everything sir...but one doubt sir...when we go from one fragment to another fragment backstack is there.... but when we go from one activity to another activity, isn't there any backstack ???
Yes..it is there for activity as well...since fragments ke baare mei baat kar rahe h toh fragment ke context mei btaya hai...it is by default feature from the beginning...
Hii sir, agr hum 2 navigation graph use kre toh user 1st navgraph (userActionActivity and it have login & singupFragment) se 2nd navgraph(HomeActivity and it hav homeFragment and many more) pe jaa ke baad backbutton press kre toh wah 1st navgraph pr na aaye app homescreen pr hi close ho jaaye ye kaise hoge mujhe smjh nhi aa rha. maine app:popUpTo="" app:popUpToInclusive="" ko try kiya pr work nhi kr rha hai
Thanks a lot. I am having the issue with the gradle. I have the gradle file with new syntax i.e its not have " buildscript " instead it has " plugins " only. I have added the class path in the dependencies under buildscript. But while I am running the application it gives me the Error : Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugCompileClasspath'. I searched the solution and applied as well but I am still Stuck here. Please help me with this. Also will you please show how to use the new syntax of the gradle file. Thank a lot again for the best videos. 👍👍
Hi Sayyed, Thanks for the update. I have not updated my android studio yet. Need to check this. Found one answer based on you error - stackoverflow.com/a/72588325 - Can you try this one? This is the recent answer
@@CheezyCode I am extremely sorry its not the classpath its a spinkit dependency which causing the trouble. I am so sorry for this. 🙏 Can you please tell which JDK version you are using and also when you update the studio please make the video on how to use new gradle syntax. Thank you for the reply and Sorry again for the trouble ....
While importing project showing this error unable to gradle "This version of the Android Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 2020.3.1 or newer." My Android Studio version 4.1.3 I changed plugin version from project structure but same error shown again
@@CheezyCode please make a video on nested fragment with tab layout alos. It is my request to you. I haven't find proper documentation of nested navigation with tab layout
Excellent video. Excellent Animations for explanation. Clean and neat. This is how you do a tutorial. Thank you Cheezy Code.
Simple, Short yet most powerful resources, probably the best channel for Android Resources🔥🔥🔥🔥
Thanks Sanyam
Hiii sir very very..........100. Thanks so much....apka explain krne ka tarika bahut achchha h...
Thanks Ashok
Thank You so much sir, for explaining like this, now we are waiting for next video on how to manage backstack to go previous fragment on button click
Thanks Shubham
thanks to share this video it helped me to solved my navhost error
Simple and sweet👌 Keep it up👍🏻
Can't wait for the next video, deep dive in the navigation framework
Thank you Ravindra
great explanation. any video of yours which I can refer to learn how to pass data in between?
Thank you for the timely upload.
Thanks Raghu
Thank you for excellent explanation ❤️, waiting for next video...
Thanks Ashraful
Excellent well explained thank you so much
Thanks Ubaid
Thank you
Waiting for your next video
Thanks Sam
awesome sir
😊
Sir, while having more than one Activity and using the MVVM pattern, where should I handle the startActivity() method? in Activity class or ViewModel class? is it good to pass context to ViewModel? Or can I use the navigation component for Activities also?
Great 👍
Please sir .....junit test ,mockito and expreso per bhi video bnaiye............
Yes bro...bas iske baad saare ye topics he h
Thanks a lot!
I want to know the best way to handle a lot of navigations in MVVM pattern. Should we do on Fragment itself or we can somehow do it from viewmodel (Data binding)?
Create a navigator class to handle navigation...
@@CheezyCode Thanks a lot, I will do that
Sir why xml why not jetpack compose?
Looking for jetpack compose navigation, please create videos on jetpack compose
Thanks Sir. 😊
Thanks 👍
Thank you 🙏🏻
You’re welcome 😊
nicely explained👍
Thanks Sir 😁
Kavi multiple file select kar ke any file aur selected file ko Recycleview me dikhane vala video v aap bana do
Chalo karte hai try...but surely nahi pta kab tak 🤐
sir possible ho to youtube pr live ayeye...kuch random questions puchte hi
yes planning both Live and Telegram Group
@@CheezyCode okay sir thanku sir
@@CheezyCode telgram group for doubt discussion is dire need ty sir
please use viewbinding instead and you can pass layout file to Fragment constructer will save your onCreateView method
yes...mentioned in the video - will be covering it in next video...
❤❤
Navigation component m hi data kese send krenge sir wk se dusre fragment per or directiondemofragemny aisa object create nhi ho paa eha h mne bhut kosish krli
hi sir how to prevent recreation of fragment A when i click on back button of Fragment B .. in this condtion everry time my fragment A is recreating
Navigation component recreates fragment after navigating from one to another fragment . Is it expected behaviour. I am seeing onCreateView if fragment called even on back stack . Is there any difference between using FragmentContainerView and fragments
Instead of adding the new fragment it's replaced, so the fragment view is destroyed, onDestroyView() is called and onCreateView() is called when back is pressed to recreate the view. Not sure why it recreates fragment always rather than replacing as we did with FragmentTrasanction
sir ek chiz btao , agar puri app mai only single activity use kre ham navigation graph use krke , or main screen mai after login or signup bottom nav ya drawer hoga to vo kha pe bnega jo activity hai vha pe ya new activity bnani pdegi ya fragment mai plz answer
single activity se manage hojayega - 2 navigation graph bhi use kar skte hai - but to keep it simple try with 2 activities
arguements in navigation ui video?
Check the playlist
Sir i have two question.
Mere 3 screen hai. Phale splash screen fir login aur akhir me home. Mai splash screen har bar dikhata hun. Par mai home screen se sabhi jaga jata hun. To mera starting destination kya hoga. Splash screen ya fir home screen
Splash
Hi Sir,
Thanks a log! for this amazing video.
I have a query here regarding back stack in fragment. Suppose we start from loginFragment->mainFragment->noteFragment. If we navigate from noteFragment->loginFragment(might be by logout action) then how will work back stack in this case?. what mainFragament do exist in this case.
1. Main fragment pe jaise he pahochege toh backstack khali kar dege. Kyoki main fragment se back button pe login screen nahi aani chaiye
2. Now main se note pe jaate hai aur fir logout karte hai toh sab kuch pop kara denge... kyoki logout kiya hai...
Ye cover karege - stay tuned for that.
Waise just 2 aur properties hai - popUp and popUpToInclusive
@@CheezyCode Thank you Sir ji
apke videos se dagger padh rha is time... thoda tuff lg rha start me ,,,kosis kr rha smgne ki
hojayega...jahan samajh na aaye wahi ruk jao - socho aisa kyo bola hai ya kara hai...clear hojayega
@@CheezyCode thankuuuuuuuuuuuuuuuuuuuuuuu sir
sir fragment fast open hotay hin ya activity?
mtlb agr hm 10 say 15 pages ki app bna rahay hin to fragment use krin to button click krnay pay fast load ho ga ya activity fast open ho gi??
2nd hm admob k banner ads lgatay hin to agr ads activity k start main hi load krwa dain to button click krnay pay activity boht slow open hoti ha. because pahlay ads load hota ha and bad main activity ka function. to isay fast krnay k leyah keya krin???????
1. No difference. dono same he h.
2. Load the ads asynchronously
Can we perform add fragment transactions in navigation? Because all transactions are replaced by default in navigation components.
Thank you
Any specific requirement? Dialogs can be used with the help of dialog destinations
@@CheezyCode MainFragment has recyclerview having pagination now suppose I scrolled list so currently on 15th page if I click on item and go to DetailFragment and press back then MainFragment is reloaded due to replace and pagination start with page 1 so If we perform add operation then MainFragment will not be reloaded
Got your problem...let me check
Got everything sir...but one doubt sir...when we go from one fragment to another fragment backstack is there.... but when we go from one activity to another activity, isn't there any backstack ???
Yes..it is there for activity as well...since fragments ke baare mei baat kar rahe h toh fragment ke context mei btaya hai...it is by default feature from the beginning...
@@CheezyCode got it, thanks sir...
Just One minute think for that students who learn all these things by Paid 😂😂
Hii sir, agr hum 2 navigation graph use kre toh user 1st navgraph (userActionActivity and it have login & singupFragment) se 2nd navgraph(HomeActivity and it hav homeFragment and many more) pe jaa ke baad backbutton press kre toh wah 1st navgraph pr na aaye app homescreen pr hi close ho jaaye ye kaise hoge mujhe smjh nhi aa rha. maine app:popUpTo=""
app:popUpToInclusive="" ko try kiya pr work nhi kr rha hai
👍
Thanks Lucky
Thanks a lot. I am having the issue with the gradle. I have the gradle file with new syntax i.e its not have " buildscript " instead it has " plugins " only. I have added the class path in the dependencies under buildscript. But while I am running the application it gives me the Error :
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugCompileClasspath'.
I searched the solution and applied as well but I am still Stuck here.
Please help me with this.
Also will you please show how to use the new syntax of the gradle file.
Thank a lot again for the best videos. 👍👍
Hi Sayyed, Thanks for the update. I have not updated my android studio yet. Need to check this. Found one answer based on you error - stackoverflow.com/a/72588325 - Can you try this one? This is the recent answer
@@CheezyCode I am extremely sorry its not the classpath its a spinkit dependency which causing the trouble. I am so sorry for this. 🙏
Can you please tell which JDK version you are using and also when you update the studio please make the video on how to use new gradle syntax.
Thank you for the reply and Sorry again for the trouble ....
JDK 8
Agar 3rd fragment se first fragment par jana hai aur previous fragment ko clear kaise krenge please guide me
3rd pe popUpto lagao
React native course b bnay gy ap?
shayad nahi
Ok but you are doing great in android I learned alot from your video thanks
@@CheezyCode and do start list of compose
yes bro...kuch pending topics hai android ke jo plan kare h - fir Compose he karenge
@@CheezyCode superb......
While importing project showing this error unable to gradle
"This version of the Android Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 2020.3.1 or newer."
My Android Studio version 4.1.3
I changed plugin version from project structure but same error shown again
Update android studio and restart
@@CheezyCode okay sir I ll let you knw about it thanks 👍
@@CheezyCode Now working thanks :)
Aur ek sawal hai.
Agar mei home fragment se ek aur fragment me jana chata hun jinke andar 4 tab hai to us case me mei kaise navigate karunga
Same he logic hoga...you can have nested fragments
@@CheezyCode please make a video on nested fragment with tab layout alos. It is my request to you. I haven't find proper documentation of nested navigation with tab layout
Utha ke basta , naap ke rasta..sab koi chala aaya IT me, IT IT IT .....IT me :)
haha...yes...mummy bole papa bole har koi hai ab IT mei
When i go from A is main fragment and jb B fragment to c me jata hu to crash ho jaa rhi h what to do
Check the logcat what is the error