onStop() of previous activity is called only after 10 seconds
See original GitHub issueI have an Activity A that starts an activity B, which contains a fragment, which in turn has a fullscreen LottieAnimationView. I display that animation while data is being fetched from the network.
I’ve noticed that the onStop() method from Activity A takes about 10 seconds to be called after B is started. In contrast, when we navigate from A to other activities, the method is called right after(< 1 second). This delayed calls makes the animation give a quick freeze, which is something we want to avoid.
Also, if I comment out the line that starts the animation in the fragment(lottieAnimationView.resumeAnimation();), onStop() is quickly called(~1 second). This makes me think that the long delay in calling that method is being caused by Lottie.
I’ve also replaced my json file with this one from lottie files: https://www.lottiefiles.com/1385-lets-go. The long delay persists.
I’m using 2.3.1 but I’ve already tried it on 2.5.0 and the behavior is the same.
Does that ring any bell already or do you need more info to investigate that?
Thanks in advance.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5

Top Related StackOverflow Question
@mateusgrb Thanks for the sample! I figured it out. Your animation actually runs significantly worse with hardware acceleration turned on. As a result, every frame was taking more than 16ms which caused Choreographer to post a vsync message at the front of the queue and prevented the onStop message from ever getting to the front until the animation stopped or a frame finished in time for the message queue to clear.
Simply turning off hardware acceleration caused your animation to become performant enough to run at 60fps.
Thanks for the fun challenge 😝
@gpeal Here’s a minimal project that reproduces the issue. I’m running on a Nexus 6P Android 8.1.0
Note that
LottieManageris a class that loads the composition on startup, so that it’s potentially already loaded when requested. That’s the strategy I’m using on my main app.The animation used here is https://www.lottiefiles.com/1505-beauty
LottieIssue.zip