https://kotlinlang.org logo
Title
y

YASAN

12/07/2021, 12:16 AM
I have a traditional 'View' on my route which is supposed to be reused since it takes a long time to load it. I hold it on a shared ViewModel. I only use it on one screen but the screen can be opened from itself (inclusive / keeping only one instance). My issue is that when I open a new instance of the screen from itself, the new screen starts before the old screen runs onDestroy which causes the view to be still attached to the previous screen. I am trying to remove/add the view to/from the parent to fix this but it causes other weird behaviors. Any ideas?
i

Ian Lake

12/07/2021, 12:17 AM
Well yeah, both screens are going to exist simultaneously during a crossfade / any other animation - both are on screen at the same time. It sounds like you'll need at least two instance
🙌 1
👀 1
y

YASAN

12/07/2021, 12:42 AM
hmmm... yeah I guess that's the best way of handling it. Ill try it, thanks.