-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Start using Binding instead of using findViewByID #3796
Comments
Hi @nangarita-coder! First of all, thanks for opening an issue! Currently, we are working hard to refactor a lot of classes in the app and release a 3.0 version. During this process, we have already moved some classes from We will take a deeper look after releasing 3.0 to keep replacing the |
Hey , i would like to work on this ;; |
Hey, @dev-divyansh Go ahead! We already use ViewBinding for some screens but there are still several uses of |
Hey @abelgardep I am beginner in OpenSource would need your guidance ; |
Sure @dev-divyansh, here you have a little guide on how to contribute You can send a PR with the changes you propose. If it's your first time, this activity could be a good candidate to start using binding instead of findViewById. That activity is the one it is shown when we try to move/copy files from one folder to another one. There are some servers available for testing: If u need something else, just let me know! |
@abelgardep hey , can you review my PR |
The findViewById method is often used in the application to retrieve a view from a view hierarchy based on an identifier but the problem is that this seemingly harmless method can, in fact, cause performance issues in your Android application if used carelessly, as it is a very demanding method in terms of resource usage.
To solve this problem it is possible to make use of view binding, this is a feature that allows you to more easily write code that interacts with views. Once view linking is enabled in a module, a link class is generated for each XML layout file present in that module. An instance of a link class contains direct references to all views that have an ID in the corresponding layout.
An example of a method in which many are made is the getView method located in the following path owncloudApp/src/main/java/com/owncloud/android/ui/adapter/AccountListAdapter.java
in this method calls are made to the findViewById method 7 times which is evidenced in the code snippet below.
TASKS
The text was updated successfully, but these errors were encountered: