Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Perf] Add ViewBinding to the project #65

Open
aakash1313 opened this issue Apr 27, 2020 · 0 comments
Open

[Perf] Add ViewBinding to the project #65

aakash1313 opened this issue Apr 27, 2020 · 0 comments

Comments

@aakash1313
Copy link
Collaborator

View binding has important advantages over using findViewById:

  1. Null safety: Since view binding creates direct references to views, there's no risk of a null pointer exception due to an invalid view ID. Additionally, when a view is only present in some configurations of a layout, the field containing its reference in the binding class is marked with @nullable.
  2. Type safety: The fields in each binding class have types matching the views they reference in the XML file. This means that there's no risk of a class cast exception.

https://developer.android.com/topic/libraries/view-binding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant