View Binding och Data Binding är Android-funktioner för att koppla kod till vyer i XML-layouts på ett säkrare och mer bekvämt sätt än den gamla findViewById. View Binding tillhandahåller typesäkra vyereferenser; Data Binding binder dessutom data direkt till layouts.
Problemet: findViewById
The old way: findViewById to get view references:
val button = findViewById<Button>(R.id.myButton)
✗ verbose; NOT type-safe (cast errors); NOT null-safe (wrong id → null → crash at runtime)
→ View/Data Binding solve these.
