vinny2020
07/20/2020, 6:54 PMsatyan
07/20/2020, 6:59 PMfindViewById
return a generic of type View
so
val button: Button = findViewById(...)
or val button = findViewById<Button>(...)
will provide you a Button
(or crash at runtime if it's not a button).
On the other hand View Binding (starting AGP 3.6) are type-safe, null safe (ex: a view present in a layout configuration and absent in another configuration).vinny2020
07/20/2020, 7:18 PM