18.2 View Binding
When view binding is enabled in an app module, Android Studio automatically generates a binding class for each layout file within the module. Using this binding class, the layout views can be accessed from within the code without the need to use findViewById() or Kotlin synthetic properties.
The name of the binding class generated by Android Studio is based on the layout file name converted to so-called “camel case” with the word “Binding” appended to the end. In the case of the activity_main.xml file, for example, the binding class will be named ActivityMainBinding.
Android Studio Arctic Fox is inconsistent in using view bindings within project templates. The Empty Activity template used when we created the AndroidSample project, for example, does not use view bindings. The Basic Activity template, on the other hand, is implemented using view binding. If you use a template that does not use view binding, it is important to know...