https://kotlinlang.org logo
#android
Title
# android
b

Bacho Kurtanidze

04/22/2020, 3:40 PM
hi Im new to view binding and trying it out in my new project. I know that it meant to be very simple and light-weight library and thats why it doesnt have many functions, but what if we could write or extend functional of generated view binding class, so for example, instead of 
binding.registerButton.setOnClickListener{}
we would be able to write
binding.onRegisterButtonClick{}
. does it make any sense? or am I talking about data binding right now?
a

Anas Tariq

04/23/2020, 1:09 PM
I think that is waste of Extension function generally because each Binding class is generated from a layout file that may or may not have the registration button. You would want to write an extension function and use it anywhere in your project i.e. all binding classes should be able to execute that extension function.