Group Group Group Group Group Group Group Group Group

View Binding Tutorial for Android: Getting Started | raywenderlich.com

In this View Binding tutorial for Android, you’ll learn how to use View Binding to find and configure your views and how to migrate from other alternatives.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/6430697-view-binding-tutorial-for-android-getting-started

how to work with recycleradapter ?

Hi skaiver, in the Migrating From Kotlin Synthetic Properties section you can see how to use View Binding in an adapter.

Hi, this is great, I have question though.

Should I use view binding even if I only have one (or two) button to interact with? or in this case findViewById() is much worth it? (in terms of performance and build time)

Hi Jasper, thanks for your question.
There’s no need to use ViewBinding and you can continue using findViewById if you are ok with it. Remember that under the hood every alternative, including ViewBinding, will use the good old findViewById.

However, in medium to large projects, using ViewBinding it’s nice to have the advantages such as null-safety and type-safety on all those views.

Also remember that if you enable ViewBinding, a class will be generated for all the xmls by default unless you explicitly state that you don’t want to use ViewBinding on that specific xml.

1 Like

This tutorial is more than six months old so questions are no longer supported at the moment for it. Thank you!