If you want a layout file to be ignored while generating binding classes, add the tools:viewBindingIgnore="true" attribute to the root view of that layout file.
@@StevdzaSan dear, I respect you so much. Could you please explain where do you refer to when saying "they"? Thank you for your time! Your videos are very helpful.
Hello. I have done exactly what you did but I encountered a problem when I migrate the Main Activity into View Binding. It did not generate ActivityMainBinding. What do you think is the reason? Thank you.
We are basically getting the value of _binding and setting in on binding variable which is read only. And this "!!" is called double bang operator: stackoverflow.com/questions/34342413/what-is-the-kotlin-double-bang-operator
Hello, great video as always. ViewBinding amazing and working fine with Fragments, yet I had a hard time to use it when I walked with several activities that not part of the navigation, inactivity fine, but when I just to the next activity I personally had a hard time to initialize and even after it seems like all smooth and well it return null. in most cases. Is there a way to use viewBinding in a project with several activities? Another question might be i should not even bother with it? because fragments seem to be the future. Yet when I only need 2-3 pages it feels faster and easy to just use Inten instead of nav_... yea forgot view binding is auto-generated so it sure quicker :)
This is stupid. When a piece of code is written, it should continue to function for at least a decade without having to make any modifications to it. Anything else is wrong. Period. Now I and tens of thousands of other devs have to go through hundreds of thousands of Activities and Fragments to "fix" formerly perfectly working code if we want our apps to ever compile again. Google's Android teams can go sodomize themselves with a broken DVD containing the Kotlin plugin, Java, 15 copies of Gradle, Android Studio, and adb, followed by some rusty nails, broken glass, a cactus, and two laptop batteries on fire. Oh and view binding isn't working for me 100% perfectly either. After several hours of wrestling with this utter nonsense, I still have a couple of references that aren't working at all despite everything set up in the XML layouts just like all of the other view references that ARE working fine. So they can put their super-special view binding trash onto its own separate broken DVD and shove the sharpest pieces they can find up their collective rears too. /endrant Okay. Now that THAT is out of my system. Back to work, I guess.
Can I use findviewbyid instead of view binding? I mean is there any problems with that? and why I should migrate to view binding? Thanks for the tutorial.
findviewbyid will do a search an entire list of id to find the view, that would reduce/lag the performance by the video, we should migrate because in the future, android doesn't support the method any more so it may cause error/crash
dataBinding is way overkill and using it requires you to use binding for all view access, you would need to convert your onClickXX, onTouchXX, etc to all use dataBinding, you are blocked from using callbacks (yes, I found this out the hard way :( ) Sure, dataBinding would work, but only use it if you also expedct to use it for everything
dataBinding is way overkill and using it requires you to use binding for all view access, you would need to convert your onClickXX, onTouchXX, etc to all use dataBinding, you are blocked from using callbacks (yes, I found this out the hard way :( )
How to use with custom alert dialogs and bottom sheet dialogs? I have 4 different layout files for dialogs and bottom sheets How to convert them into ViewBinding with activity and fragments?
And that is suppose to be easy, whoever in in charge of Android Studio is not very good at their job. Why on earth is this so complex, in other technologies you can use the name of the controls you add to the GUI.
My Master!
Great Video! This solved the issue I had. Thank you @Stevdza-San
You are perfect bro!!!
please make a tutorial about Jetpack Compose
Hi, any plans on doing jetpack compose?
If you want a layout file to be ignored while generating binding classes, add the tools:viewBindingIgnore="true" attribute to the root view of that layout file.
Why would I want to do that?
@@vishalgaurav4411 I have the same question, wouldn't I just not wrap the view in a ?
Great video! Thank you so much brother🤝🏾🤝🏾
Hi ,
Don't know how to contact you on udemy .
At video 32 , 3:34
3 and 4 methods have same name .. 4 should ld be areContents something
if i have this sentence "val apellido = addApellido_et.text.toString()" how can i change in binding????
Amazing bro
But why ? 😭
- They pollute the global namespace
- They don’t expose nullability information
- They only work in Kotlin code
i feel like google will eventually find a better solution or workaround though
@@StevdzaSan dear, I respect you so much. Could you please explain where do you refer to when saying "they"? Thank you for your time! Your videos are very helpful.
@@Tone463 He refers to Kotlin-Synthetics
@@bagadeshkumarr9502 thanks friend! 👋🏽
Hello. I have done exactly what you did but I encountered a problem when I migrate the Main Activity into View Binding. It did not generate ActivityMainBinding. What do you think is the reason? Thank you.
Great explanation, thanks bro
Why binding instead of findViewById? Is there any resource or speed gain or...?
findViewById is more computation work needed
It traverses the entire view hierarchy, where viewbinding does not.
There is a diference if it's RecyclerView?
Yes a slightly difference. I'll record a video about it as well (After my Hash Generator Series).
@@StevdzaSan Thank you
it's great bro, but, can you show how to roll back to the previous version on project structure?
What is the Parcelize alternative?
See: developer.android.com/kotlin/parcelize
How do I start an activity from fab after using viewbinding?
Hi, just transitioning from java, and... what is the java equivalent of val binding get() = _binding!! and also what is that !! at the end? :)
We are basically getting the value of _binding and setting in on binding variable which is read only. And this "!!" is called double bang operator:
stackoverflow.com/questions/34342413/what-is-the-kotlin-double-bang-operator
@@StevdzaSan OK thx, but why not just val binding = _binding? Why get()?
@4YT It's a getter which can omit the type automatically, plus it will be called every-time we access the property.
when i add include layout it's not call when using view Binding .. how to solve that? thanks
also how using view binding on bottom sheet dialog?
Thank you very much bro!
Hello, great video as always. ViewBinding amazing and working fine with Fragments, yet I had a hard time to use it when I walked with several activities that not part of the navigation, inactivity fine, but when I just to the next activity I personally had a hard time to initialize and even after it seems like all smooth and well it return null. in most cases. Is there a way to use viewBinding in a project with several activities? Another question might be i should not even bother with it? because fragments seem to be the future. Yet when I only need 2-3 pages it feels faster and easy to just use Inten instead of nav_... yea forgot view binding is auto-generated so it sure quicker :)
does passing Data, works in View binding method ?
This is stupid. When a piece of code is written, it should continue to function for at least a decade without having to make any modifications to it. Anything else is wrong. Period. Now I and tens of thousands of other devs have to go through hundreds of thousands of Activities and Fragments to "fix" formerly perfectly working code if we want our apps to ever compile again. Google's Android teams can go sodomize themselves with a broken DVD containing the Kotlin plugin, Java, 15 copies of Gradle, Android Studio, and adb, followed by some rusty nails, broken glass, a cactus, and two laptop batteries on fire. Oh and view binding isn't working for me 100% perfectly either. After several hours of wrestling with this utter nonsense, I still have a couple of references that aren't working at all despite everything set up in the XML layouts just like all of the other view references that ARE working fine. So they can put their super-special view binding trash onto its own separate broken DVD and shove the sharpest pieces they can find up their collective rears too. /endrant Okay. Now that THAT is out of my system. Back to work, I guess.
followed your steps line by line but showing error,and asking to create class FragmentHomeBinding
Rebuild the project if your Android Studio somehow does not recognize the class.
@@StevdzaSan It was typo mistake, thank you very much for your reply
Can I use findviewbyid instead of view binding? I mean is there any problems with that? and why I should migrate to view binding?
Thanks for the tutorial.
findviewbyid will do a search an entire list of id to find the view, that would reduce/lag the performance
by the video, we should migrate because in the future, android doesn't support the method any more so it may cause error/crash
@@noahvo6673
Thank you!
@@noahvo6673 So basically we have no choice
Thanks a lot!!!!!
What about databinding? Is it a better alternative ?
View Binding and Data Binding are both fine.
Until next year...
dataBinding is way overkill and using it requires you to use binding for all view access, you would need to convert your onClickXX, onTouchXX, etc to all use dataBinding, you are blocked from using callbacks (yes, I found this out the hard way :( ) Sure, dataBinding would work, but only use it if you also expedct to use it for everything
What's your favorite Android app you've made and why?
Thank you this video are very helpful but the problem is not solved
thnx
Wait @Parcelize too?? Oh noo.
Just add this plugin and everything will be just fine: id 'kotlin-parcelize'
@@StevdzaSan thank you master 🙏🙏🙏
I would just use "dataBinding true", it includes View Binding.
Using data binding for this is like using a sword for cutting potato
dataBinding is way overkill and using it requires you to use binding for all view access, you would need to convert your onClickXX, onTouchXX, etc to all use dataBinding, you are blocked from using callbacks (yes, I found this out the hard way :( )
thanks, but if u have a hundred files to migrate then that's a huge effort
How to use with custom alert dialogs and bottom sheet dialogs?
I have 4 different layout files for dialogs and bottom sheets
How to convert them into ViewBinding with activity and fragments?
And that is suppose to be easy, whoever in in charge of Android Studio is not very good at their job. Why on earth is this so complex, in other technologies you can use the name of the controls you add to the GUI.
viewBinding is safe
View binding alternative