Changes

Jump to: navigation, search

An Android Jetpack Data Binding Tutorial

39 bytes removed, 18:43, 16 January 2019
Adding Binding Expressions
With these changes made, the next step is to begin inserting some binding expressions into the view elements of the data binding layout file.
== Adding Adding Binding Expressions ==
The first binding expression will bind the resultText TextView to the result value within the model view. Edit the main_fragment.xml file, locate the resultText element and modify the text property so that the element reads as follows:
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="MainFragment"
    android:text='@{safeUnbox(myViewModel.result) == 0.0 ? "Enter value" : String.valueOf(safeUnbox(myViewModel.result)) + " euros"}'
    app:layout_constraintBottom_toBottomOf="parent"

Navigation menu