View Binding i Data Binding su Android značajke za povezivanje koda s view-ovima u XML layoutima na sigurniji i praktičniji način nego stari findViewById. View Binding pruža type-safe reference na view-ove; Data Binding dodatno vezuje podatke direktno u layoute.
Problem: 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.
