View Binding i Data Binding to funkcje systemu Android umożliwiające bezpieczniejsze i wygodniejsze łączenie kodu z widokami w layoutach XML niż stary findViewById. View Binding zapewnia typobezpieczne odwołania do widoków; Data Binding dodatkowo wiąże dane bezpośrednio z layoutami.
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.
