<@U0BLRBFMM> thanks, I assumed that since I was us...
# kodein
d
@salomonbrys thanks, I assumed that since I was using the
androidContextScope
it would provide the context. However, I tried your suggestion and now I get
com.github.salomonbrys.kodein.Kodein$NotFoundException: No factory found for bind<PersistenceService>() with ? { Object -> ? }
s
Try
bind<GreetPresenter>() with scopedSingleton(androidActivityScope) { GreetPresenter(it as GreeterView, instance(), with(it as Activity).instance()) }
d
Thanks that worked, isn't
it
an
Activity
or is it treated as
Any
at that point which is why the cast is required?
s
As it is not typed in the factory, it is Any.
d
how would I go about getting an singleton instance created tied to the application context? as at the moment each activity gets their own version of the PersistenceService but ideally there should be just the one instance?