covidsafe / App-Android

Doctors and researchers at the University of Washington with Microsoft volunteers have built a tool to alert you about highly relevant public health announcements, potential exposure to COVID-19, and to assist public health officials and contact tracing teams without compromising your personal privacy.
http://covidsafe.cs.washington.edu/
MIT License
65 stars 20 forks source link

[Perf] Add ViewBinding to the project #65

Open aakash1313 opened 4 years ago

aakash1313 commented 4 years ago

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