Skip to content

Instantly share code, notes, and snippets.

@droid-lover
Last active October 5, 2020 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save droid-lover/166499256ddc20b0562f4647fa0fddb8 to your computer and use it in GitHub Desktop.
Save droid-lover/166499256ddc20b0562f4647fa0fddb8 to your computer and use it in GitHub Desktop.
//add this annotation to make it accessible all dependencies from DI Graph created using HILT
@AndroidEntryPoint
class MainActivity : AppCompatActivity() {
//access viewmodel like this
private val sampleViewModel: SampleViewModel by viewModels()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
//code
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment