I have used data-binding in two projects, I would say data-binding is too bad for your project, it can be the cause of spaghetti code. Let’s see the pros and cons of data-binding.
1- Easy to use
2- Less boilerplate code (eliminating findViewById and more)
3- Fit to MVVM pattern
4- Synchronize data between sources and UI elements
1- Showing unrelated errors
Showing unrelated errors when compiler can’t compile the project for any problem, (e.g. Dagger2 or Room or Realm) so compiler can’t generate data-binding related classes so it will show unrelated errors like below:
2- Business logic belongs in code
It can be more complex if you have different layouts for different screens.
3- Updating view after changing data can be cause of blink
4- Auto-rename for package names doesn’t work on XML files
5- The auto-generated .class files increases app size
it will matter if you have tons of it.
- Use databinding but do not use events !! (It can fix the cons #2)
- Using ButterKnife
- Using traditional way, findViewById()
- Using Kotlin Android Extensions