Nir Golan
08/01/2019, 6:43 PMvoben
08/01/2019, 6:46 PMandroidContext()
like someone else already mentioned to inject android context. Or using parameterOf(this)
where this
is the activity contextLuka
08/02/2019, 6:26 AMstartKoin { androidContext(this@App) }
Then in your module definitions you can use androidContext()
method to obtain it.
If you need to inject activity context somewhere you can use something like this to define it: single { (activity: AppCompatActivity) -> SomeDefinition(activity) }
and then call it like this: val someInstance: SomeInstance by inject { parametersOf(this) }