(Placing this here since there is no category for Ch. 19)
After completing the BeatBox chapters with Data Binding, I started looking in to the Jetpack View Binding. It appears from the Chapter 19 writeup that the Data Binding implementation includes View Binding as well.
Listing 19.4 and 19.5 contain the following two statements which shows the View Binding.
val binding: ActivityMainBinding = DataBindingUtil.setContentView(this, R.layout.activity_main)
binding.recyclerView.apply {
layoutManager = GridLayoutManager(context, 3)
}
Could we replace the first line with the following to do the explicit View Binding?
val binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)