Created
March 26, 2021 18:13
-
-
Save viniciusalvesmello/999766ff333206562062692a6a4d16d9 to your computer and use it in GitHub Desktop.
Instância ViewModel Dagger 2
This file contains 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
@AndroidEntryPoint | |
class MyFragment : Fragment() { | |
... | |
@Inject | |
lateinit var viewModelFactory: ViewModelFactory | |
private val viewModel: MyViewModel by lazy { | |
ViewModelProvider(this, viewModelFactory)[MyViewModel::class.java] | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment