Skip to content

Add View Binding #11116

@Jatin887

Description

@Jatin887

2026 update: Task List

Implement View Binding
Advantages of using it over findViewById
Null safety – Properties in the generated class are non-null. In the case of multiple layout versions, e.g. layout file for different screen orientation or size, if some configuration contains an id that is not present in others, the generated property will be nullable.
Type safety – Binding properties will be correctly typed, even with custom views.

Describe the solution you'd like
I will try to implement ViewiBinding for all activities and fragments.

Describe alternatives you've considered
This issue can be marked as good first issue so it will be helpful for new contributors. I will make a readme for this issue which have all the information about how to implement viewBinding for activities and fragments .

Additional context
Advantages
Interoperability – Generated classes are in Java and are optimized for Kotlin-Java interoperability.
Injection capability – Generated class can be injected in activity or fragment.
Speed – There are no impacts on build speed, as it doesn’t use an annotation processor. After the first build with View Binding is enabled, it will dynamically generate new properties. And if you add new view elements to your XML, there is no need to rebuild every time

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions