Does Android Data Binding replaces findViewById? -
i saw articles when data binding announced have titles "time leave findviewbyid", reason thought it's going replacement libs butterknife when looked @ , seemed me it's links model classes view (title -> r.id.title) when change title in view or in code reflect on other end.
is or missing else?
that 1 aspect, isn't biggest. can add expressions xml , have data assigned directly view. example, if have textview showing first name, might have expression like:
<textview android:text="@{user.firstname}" .../>
this helps eliminate boilerplate code linking data ui. reason not need findviewbyid
.
another convenience can assign event listeners views in xml. appears similar android:onclick, though doesn't have performance overhead of reflection.
there other conveniences, major 1 data linking ui.
Comments
Post a Comment