Systers, an AnitaB.org community
Use Kotlin Lazy Delegated Properties to initialise ViewModels (Mentorship - Android)
Prerequisite:
- Fork and clone the project from the github repository
- Follow the documentation for successfully setting up the project
- Open Project in Android Studio
Steps:
- We are using the Kotlin
lateinit
keyword to initialize ViewModels eg here - Instead, we should use Lazy initialization here
private val sendRequestViewModel by lazy { ViewModelProviders.of(this).get(SendRequestViewModel::class.java) }
- Find all such instances where we are using
lateinit
keyword to initialize ViewModels and replace it with lazy initializer.
Resources:
- If you need help or get lost, post a response to our questions topic in our #gci stream.
- API Documentation
Work Submission:
After successfully fixing this issue, commit and make a Pull Request. Title of PR should contain "Program:GCI"
- Commit Message Style Guide
- Sample PR structure
- Make sure to attach either screenshot or GIF of the fixed issue
Task tags
Students who completed this task
_daksha_, BartekPacia, i_maier