43.5 Working with the Binding Class
The next step is to modify the code within the MainFragment.kt file to inflate the data binding. This is best achieved by rewriting the onCreateView() method:
.
.
import androidx.databinding.DataBindingUtil
import com.ebookfrenzy.viewmodeldemo.R
.
.
class MainFragment : Fragment() {
companion object {
fun newInstance() = MainFragment()
}
private lateinit var viewModel: MainViewModel
lateinit var binding: MainFragmentBinding
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle...