-
Notifications
You must be signed in to change notification settings - Fork 38
Description
First of all, thank you so much for such elaborate examples
and the amount of effort you're putting into bringing FP to Kotlin!
I've noticed that in all 4 examples
Activity just passes a reference to itself to the other part of the app
( e.g. by calling getSuperHeroes().run(heroesContext)
in onResume()
),
so when the data is fetched from the server,
it is displayed by calling drawHeroes()
method directly on that Activity reference:
private fun drawHeroes(view: SuperHeroesListView, success: List<CharacterDto>) {
view.drawHeroes(success.map {
SuperHeroViewModel(
it.id,
it.name,
it.thumbnail.getImageUrl(PORTRAIT_UNCANNY),
it.description)
})
}
But what if this Activity is currently undergoing a Configuration change?
(it can be destroyed and not yet initialized again)
I assume in that case it may result in NPE or some other exception.
How do you actually handle this situation in such architecture?
P.S. I haven't been able to really check this, but I'm pretty sure that's how it is.