In android Apprentice, when you making a nav drawer for placebook. The author used android kotlin extension. However I t is now deprecated in favor of viewbinding. The problem is with the Viewbinding I am able to get the toolbar working with the main view xml.
However with the Viewbinding Setcontentview(R.layout.activity_maps) is not working. Therefore you have to set the activity_map to binding. However after I finish setting it and pass the root to the setcontentview. I still get an error when I compile and run.
I’m in the process of updating that part of the book. What I did was add an id to the included layouts. This allows you to reference the included layouts with something like databinding.navlayout.textview
Hello sir it is not that part sorry. I am referring to page 384 drawerLayout.With the Kotlin android extension all I need to do is import main_view_ map.Xml as that will activate the toolbar. I am able to do that with Viewbinding without any issue
With kotlin android extension
Setcontentview will look like this:
setContentView(R. layout.activity.maps).
If I use viewbinding for this part I get a runtime error.
Sir Look at this picture please
I don’t think you want to have 2 different Binding classes. This is what I have:
databinding = ActivityMapsBinding.inflate(layoutInflater)
setContentView(databinding.root)