I am currently working on an Android library which...
# compose-android
t
I am currently working on an Android library which helps create a floating view on the screen. Recently, I added support for Composable and with the help of a custom LifecycleOwner, I can show/remove composable without any issue. However, when scrolling through the LazyColumn/Row/etc, if I call removeView before the animation stops, the app start crashing. this is the error message “Cannot start this animator on a detached view!”. I stuck in this issue the whole day, sorry if i bother you guys 😢 . Thank you I also asked on stackoverflow, you can see more detail there https://stackoverflow.com/questions/75788922/jetpack-compose-with-windowmanager-cannot-start-this-animator-on-a-detached-vi
i
Throwing some ideas: have you tried stopping the animation or scrolling before removing the view?
i
Why are you only stopping the Lifecycle instead of actually moving it to DESTROYED and triggering the disposal of the composition?
t
That worked! After calling “destroyed” when removing the view, the issue is now gone, thank you for pointing me out ❤️