Skip to content

Use viewBinding instead of findViewById( ) #8

@theayushyadav11

Description

@theayushyadav11

Issue Description:

[Chore] Replace findViewById() with ViewBinding

Problem:
The app currently uses findViewById() to reference UI elements, which is boilerplate-heavy, prone to NullPointerExceptions, and less efficient compared to ViewBinding. Migrating to ViewBinding will improve code readability, performance, and type safety.

Expected Solution:

  • Enable ViewBinding in the project by updating the build.gradle file.
  • Replace all instances of findViewById() with ViewBinding.
  • Ensure proper lifecycle handling of binding instances to avoid memory leaks.

Steps to Implement:

  1. Enable ViewBinding in build.gradle:
    android {
        viewBinding {
            enable = true
        }
    }
  2. Replace findViewById() in activities, fragments, and adapters with ViewBinding.
  3. Use proper lifecycle management for binding in fragments to avoid memory leaks.

Acceptance Criteria:

  • All findViewById() references are replaced with ViewBinding.
  • UI interactions remain fully functional after the migration.
  • Proper lifecycle management is followed in fragments and adapters.

Let me know if you need code examples for the migration! 🚀

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions