Skip to content

Instantly share code, notes, and snippets.

@adityaladwa
Created January 8, 2017 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adityaladwa/7f7d524d3fffc7cadadca410debc3823 to your computer and use it in GitHub Desktop.
Save adityaladwa/7f7d524d3fffc7cadadca410debc3823 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="user"
type="com.ladwa.aditya.databinding_blitzkrieg.User"/>
<variable
name="presenter"
type="com.ladwa.aditya.databinding_blitzkrieg.Presenter"/>
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{user.firstName}"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{user.lastName}"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{Integer.toString(user.age)}"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="@{presenter::onClickMethod}"
android:text="Method Reference"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="@{()->presenter.onClickReference(user)}"
android:text="Listener Binding"/>
</LinearLayout>
</layout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment