Pegah Ahmadvand
Pegah Ahmadvand

Reputation: 107

Android Studio can not generate Binding class in new activity while use DataBinding

While using data binding , I have class MainActivityBinding. but when i create new Activity(for example SecondActivity), SecondActivityBinding not generated. I removed

"dataBinding { enabled = true }"

from gradle and add it again and make project but SecondActivityBinding not generated. how I can solve this problem.

Upvotes: 0

Views: 452

Answers (1)

Traendy
Traendy

Reputation: 1503

The Binding class is generated when you frame your SecondActivity layout.xml file with

<layout> ... </layout>

By default, a Binding class will be generated based on the name of the layout file, converting it to Pascal case and suffixing “Binding” to it. The above layout file was activity_main.xml so the generate class was ActivityMainBinding.

Upvotes: 3

Related Questions