https://kotlinlang.org logo
#compose-android
Title
# compose-android
t

Tri Do

03/20/2023, 10:35 AM
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

Iliya Gogolev

03/20/2023, 9:05 PM
Throwing some ideas: have you tried stopping the animation or scrolling before removing the view?
i

Ian Lake

03/21/2023, 5:37 AM
Why are you only stopping the Lifecycle instead of actually moving it to DESTROYED and triggering the disposal of the composition?
t

Tri Do

03/21/2023, 7:33 AM
That worked! After calling “destroyed” when removing the view, the issue is now gone, thank you for pointing me out ❤️
11 Views