I\'m trying to follow data-binding example from official google doc https://developer.android.com/tools/data-binding/guide.html
except that I\'m trying to apply data
If you are using ViewModel and LiveData This is the sufficient syntax
Kotlin Syntax:
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return MartianDataBinding.inflate(
inflater,
container,
false
).apply {
lifecycleOwner = viewLifecycleOwner
vm = viewModel // Attach your view model here
}.root
}