Created
June 26, 2020 15:33
-
-
Save JoseAlcerreca/1ab5e41773bc692be2b38be267424019 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Copyright 2020 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 --> | |
// With Dagger2 or dagger.android | |
class SessionDetailFragment : ... { | |
@Inject lateinit var viewModelFactory: ViewModelProvider.Factory | |
private lateinit var sessionDetailViewModel: SessionDetailViewModel | |
… | |
override fun onCreateView(...) { | |
// Helper method that obtains ViewModel with the injected factory | |
sessionDetailViewModel = viewModelProvider(viewModelFactory) | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment