Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable View Binding #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

LLJY
Copy link

@LLJY LLJY commented Apr 7, 2021

view binding is a type-safe way to interact with your layout from view. Every XML created gets a generated Binding class which you can use to access the ui components.
this is usually preferred over findViewById as it is type-safe and makes your code look cleaner, especially if you have a lot of components, you can avoid having tons of global variables.

please see https://developer.android.com/topic/libraries/view-binding

view binding is a type-safe way to interact with your layout from view. Every XML created gets a generated Binding class which you can use to access the ui components.
this is usually preferred over findViewById as it is type-safe.
@tytydraco tytydraco added the enhancement New feature or request label Apr 8, 2021

preferences = findViewById(R.id.preferences)
preferences = binding.preferences;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realised i accidentally added a semicolon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants