What is a view model and how can I use it to replace findViewById with View Binding and
I am working on a basic bluetooth app in android studio and I am having trouble with view binding. So far I have this in my MainActivity.kt
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
...
Later in the onCreate I have this line
val btnONOFF = findViewById(R.id.btnONOFF) as Button
and I would like to replace the findViewById using viewbinding but...