I have an android
app, its developed in kotlin, also we use kodein
dependence for binding the data.When the binding the data first time it will bind correctly but it does not bind at second time call.
inner class CallmyClass() : MultiDexApplication(), KodeinAware {
val diModel = Kodein.Module {
bind<ExchangeRateProvider>() with singleton { CryptoCompareExchangeProvider(this@App, instance()) }
bind<SyncProgressProvider>() with singleton { SyncProgressProvider() }
bind<WallethKeyStore>() with singleton { keyStore }
bind<Settings>() with singleton { KotprefSettings }
bind<CurrentTokenProvider>() with singleton { CurrentTokenProvider(instance()) }
bind<AppDatabase>() with singleton { Room.databaseBuilder(applicationContext, AppDatabase::class.java, "maindb").build() }
bind<NetworkDefinitionProvider>() with singleton { NetworkDefinitionProvider(instance()) }
bind<CurrentAddressProvider>() with singleton { InitializingCurrentAddressProvider(keyStore, instance(), instance(), applicationContext,1) }
bind<FourByteDirectory>() with singleton { FourByteDirectoryImpl(instance(), applicationContext) }
}
val appDiModule = Kodein.Module(allowSilentOverride = true) {
import(diModel)
}
override val kodein: Kodein = Kodein {
import(appDiModule)
}
}
the problemo is, when binding at first time this code will excute
bind<CurrentAddressProvider>() with singleton { InitializingCurrentAddressProvider(keyStore, instance(), instance(), applicationContext,i) }
and "InitializingCurrentAddressProvider()"
this class called and executed successfully.
BUT when i try to call these line
bind<CurrentAddressProvider>() with singleton { InitializingCurrentAddressProvider(keyStore, instance(), instance(), applicationContext,i) }
at second time the line is executed but
"InitializingCurrentAddressProvider()"
this class does not execute. thats the problem, if the second the class is execute means
i will get the result then automatically result will bind. but it does not execute.