@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
salomonbrys
02/07/2018, 11:17 AM
Try
bind<GreetPresenter>() with scopedSingleton(androidActivityScope) { GreetPresenter(it as GreeterView, instance(), with(it as Activity).instance()) }
d
david.pacheco
02/07/2018, 12:01 PM
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
salomonbrys
02/07/2018, 3:50 PM
As it is not typed in the factory, it is Any.
d
david.pacheco
02/08/2018, 9:30 AM
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?