Aman Shandilya
Jul 21, 2017 · 1 min read

it generates automatically as per your activity layout name when you include your activity layout in <layout> tag.

like this

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="sample.android.databinding.MainActivity"
>

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textSize="20sp"
/>

</RelativeLayout>
</layout>

So when you use elements of this layout with defined id’s so there is no need for the statement ‘findViewById’, you can directly use them from ActivityMainBinding class. So it is a auto generated class.

)
    Aman Shandilya

    Written by

    Sr. Software Engineer (Android)