43.1 Removing the Redundant Code
If you have not already done so, copy the ViewModelDemo project folder and save it as ViewModelDemo_LiveData so that it can be used again in the next chapter. Once copied, open the original ViewModelDemo project ready to implement data binding.
Before implementing data binding within the ViewModelDemo app, the power of data binding will be demonstrated by deleting all of the code within the project that will no longer be needed by the end of this chapter.
Launch Android Studio, open the ViewModelDemo project, edit the MainFragment.kt file and modify the code as follows:
package com.ebookfrenzy.viewmodeldemo.ui.main
.
.
import androidx.lifecycle.Observer
class MainFragment : Fragment() {
.
.
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
&...