Hi, Stevdza. Great video, right to the point. Is there a video example showing how to pass more than 1 value with safe args? I would really appreciate this, because i'm struggling with this issue on my project. Thank you so much!!
Stefane brate zivio sto godina!!! Ovo mi treba!! Imas li ono nesto tipa buyMeCoffee ili patreon ? Zasluzio si pivo ili dva ili kafu, štagod ti više paše :D
What happened before the creation of the video, what resource gave an understanding of the topic especially for you, it is obvious that it was of high quality ?! Could you share? P.S. Subscribed
@@StevdzaSan Thanks, I have checked that, it's true. But at the moment 3:38 can we use `val args = SecondFragmentArgs.fromBundle(arguments!!)` or it is old decision?
Awesome tutorial but I have one question. What if I need to pass two parameters insted of one. Like Integer as well as String. Without passing object. It is possible??
Hey, man, thanks! You are cool! Im from Belarus and i dont know English, but im anderstand you and im anderstent how do what you tell!!!! Thanks, man!!!!
I followed all of your guidelines even the documentation but I still get this error: Android linking resource failed, AAPT: error: failed writing to 'directory\project\app\build\intermediates untime_symbol_list\debug\R.txt': The data is invalid. (13). What does it mean? how to fix that?
Navigation component is well structured and easy to use. Using fragments with just one activity is one of the main purposes of nav component. Btw more videos coming about nav component.
@@StevdzaSanThank u vm, but my real problem statement, I m selecting a user role from first Activity--->carry role value as an intent to MainActivity(comes with Navigation drawer side menu + fragments(home,gallery... etc) by default) and I m trying to pull the role from MainActivity to any Fragments that I switch to. I tried to the following in MainActivity where Navcontroller is setted. bundle.putString(...); NavController.setGraph(R.navigation.mobile_navigation,bundle); On receiving Fragments String role = getArguments.getString("role"); Only recieving the role onStartDestinationFragment which is Home but in others fragments(gallery,profile etc...) i m receiving null value. I tried safeArgs ,Bundles I still receiving null value of role when in other Fragments. 🙏Hope I m clear
Thanks a lot. I am having problems when trying to define val args : SecondFragmentArgs by navArgs(). The error says: "property delegate must have a getvalue". However I noticed that android didn´t generate the three classes (two for directions and one for arguments). Do you have any suggestion for me, please?
This worked 4 years ago, but it doesn't in 2024. I'm an experienced programmer, but totally new to Android. Can anyone point me in the right direction? the structure of the gradle.build files has completely changed in the meantime and something as simple as setting "classpath" gives an error.
That's a property delegate. We are lazily getting arguments during variable declaration. Something similar to "by lazy {}". Classes with postfix "Args" and "Direction" are automatically generated by Safe Args plugin.
Hello dears. I can't generate fragment direction in my project. Do you have any solutions? I have add class path and apply plugin but still not working.
@@MiYakudzik it's already generated but just didn't show on that folder. You should declear your fragment direction as my example. Ex: val direction: FragmentDirection =
how do I fix safeargs for java? My build.gradle file doesn't have a buildscript section, and my dependencies don't contain any classpaths I added the following to build.gradle(project): id("androidx.navigation.safeargs") version "2.5.3" apply false and id ("androidx.navigation.safeargs") in build.gradle(module). When I write the text of myArg is red. Something's wrong but I don't know what. Also in my java file (FirstFragment), how do I navigate to SecondFragment and send my data? Currently I navigate this way: NavHostFragment.findNavController(FirstFragment.this) .navigate(R.id.action_FirstFragment_to_SecondFragment); But I have a variable int count, and I want to send the value of it as myArg. How do I do that?
This is the best, short, straight to the point explanation I have seen on the subject.
Thank you very much, you earned a new supporter
After half a day looking to solve my problem, you saved me. Thank you!
Thank you so much! You have no idea how your tutorials have helped us, making easy tasks that looked daunting and impossible. All the best.
Thank you Christian, I'm happy for that! 😊
Great explanation! I got stuck in one point, couldn't see ...FragmentArgs class - and saw in video, just need to rebuild project. Thanks a lot!
Really great tutorial, super concise. Thank you!
Very helpful tutorial.
Thank You.
Thank You, Thanks for making these amazing videos
Hi, Stevdza.
Great video, right to the point.
Is there a video example showing how to pass more than 1 value with safe args?
I would really appreciate this, because i'm struggling with this issue on my project.
Thank you so much!!
You can pass multiple values using Array as a type, or your own data class as parcelable. I'll make a video about it in the future.
@@StevdzaSan Thank you, I apreciate that, I will be awaiting the video!! hahah
clear concise and to the point!!!
Stefane brate zivio sto godina!!! Ovo mi treba!! Imas li ono nesto tipa buyMeCoffee ili patreon ? Zasluzio si pivo ili dva ili kafu, štagod ti više paše :D
Amazing one Thankyou for this one
Thank you so much. It really helped
Very useful tutorial, thank you Stevdza-San
Thank you. that was Very helpful
the Gradle version is new so I don't know how to add Safe Args. Can you help me?
Great Tutorial
What happened before the creation of the video, what resource gave an understanding of the topic especially for you, it is obvious that it was of high quality ?! Could you share? P.S. Subscribed
Android documentation and practice.
@@StevdzaSan Thanks, I have checked that, it's true. But at the moment 3:38 can we use `val args = SecondFragmentArgs.fromBundle(arguments!!)` or it is old decision?
my app dont generate de clasess, do you know why?
Make sure you’ve implemented the safeArgs inside build.gradle
Awesome tutorial but I have one question. What if I need to pass two parameters insted of one. Like Integer as well as String. Without passing object. It is possible??
You explain really great. Please make a video on MVVM Architecture.
He actually did...
Good tutorial! 👍
Nice Explanation, I have one question though how to pass an object by using safe arg?
Am having challenges syncing the dependencies
Ive been having this problem where safeArgs arent working. Even tho its enabled in my gradle file
Rebuild your project, or close and run Android Studio again after you have synced your project.
sir how to pass image from first fragment to second fragment , in your example you use int to pass the number
Hey, man, thanks! You are cool! Im from Belarus and i dont know English, but im anderstand you and im anderstent how do what you tell!!!! Thanks, man!!!!
i have a question, why do we use safe args if we have viewmodel-liveData ?. thanks
Sir, can you tell how to maintain the app menu using navigation component
I followed all of your guidelines even the documentation but I still get this error: Android linking resource failed, AAPT: error: failed writing to 'directory\project\app\build\intermediates
untime_symbol_list\debug\R.txt': The data is invalid. (13).
What does it mean? how to fix that?
So... should I be using fragments instead of activities now? How do they act with the application's main thread?
Navigation component is well structured and easy to use. Using fragments with just one activity is one of the main purposes of nav component. Btw more videos coming about nav component.
Do you sell courses or personalized tutoring? I really like the way you teach, simple, concsice and very good!
Great Video ,so how do I pass a value from Navigation MainActivity to any Fragments I switch to
Solution: your MainActivity should not contain anything except NavHostFragment. Use your fragments to handle everything else.
@@StevdzaSanThank u vm,
but my real problem statement, I m selecting a user role from first Activity--->carry role value as an intent to MainActivity(comes with Navigation drawer side menu + fragments(home,gallery... etc) by default) and I m trying to pull the role from MainActivity to any Fragments that I switch to.
I tried to the following in MainActivity where Navcontroller is setted.
bundle.putString(...);
NavController.setGraph(R.navigation.mobile_navigation,bundle);
On receiving Fragments
String role = getArguments.getString("role");
Only recieving the role onStartDestinationFragment which is Home but in others fragments(gallery,profile etc...) i m receiving null value.
I tried safeArgs ,Bundles I still receiving null value of role when in other Fragments.
🙏Hope I m clear
thank you
Thanks a lot. I am having problems when trying to define val args : SecondFragmentArgs by navArgs(). The error says: "property delegate must have a getvalue". However I noticed that android didn´t generate the three classes (two for directions and one for arguments). Do you have any suggestion for me, please?
did you solved this?
This worked 4 years ago, but it doesn't in 2024. I'm an experienced programmer, but totally new to Android. Can anyone point me in the right direction? the structure of the gradle.build files has completely changed in the meantime and something as simple as setting "classpath" gives an error.
even after adding toString the app crashes there is something wrong with the code
The safearga doesnot genarate the classes🥲
Rebuild your project
@@StevdzaSan i cleaned it and rebuild it so many times but still the same proplem
@@waleefalrooh8 Check your dependencies and plugin.
@@StevdzaSan i checked it now it is in the project but it's not in the java (generated) file.. i don't know where it is though
@@waleefalrooh8 Strange, you should ask on stackoverflow then..
Dont understand the (by navargs) syntax , would you explain please
That's a property delegate. We are lazily getting arguments during variable declaration. Something similar to "by lazy {}".
Classes with postfix "Args" and "Direction" are automatically generated by Safe Args plugin.
@@StevdzaSan thanks a lot.
I don't know why after I sync my project, the project that was supposed to be generated automatically is not there. Do you know the reason?
Build->clean project->rebuild project
@@nutankumari9977 Already done that before asking this yet still not showing
Hello dears. I can't generate fragment direction in my project. Do you have any solutions? I have add class path and apply plugin but still not working.
I have the same problem. Did you find solution?
@@MiYakudzik it's already generated but just didn't show on that folder. You should declear your fragment direction as my example. Ex: val direction: FragmentDirection =
@@MiYakudzik and also if your project is java you should declear FragmentDirection f =
@@MiYakudzik it will show your generated direction after you declear this variable.
@@layly7961 Thank you so much. I almost gave up thinking the plugin is bugged
Gradle dependency for SafeArgs is outdated
PLEASE SOMEONE SHOULD HELP HAVE RESEARCHED MY ASS OUT AND CANT FIND THE SOLUTION I RAN INTO THESE NAVCONTROLLER ERROR
THE APP JUST EXITS WITH THIS ERRORS
how do I fix safeargs for java? My build.gradle file doesn't have a buildscript section, and my dependencies don't contain any classpaths
I added the following to build.gradle(project): id("androidx.navigation.safeargs") version "2.5.3" apply false
and id ("androidx.navigation.safeargs") in build.gradle(module).
When I write
the text of myArg is red. Something's wrong but I don't know what.
Also in my java file (FirstFragment), how do I navigate to SecondFragment and send my data?
Currently I navigate this way:
NavHostFragment.findNavController(FirstFragment.this)
.navigate(R.id.action_FirstFragment_to_SecondFragment);
But I have a variable int count, and I want to send the value of it as myArg. How do I do that?