multithreading – Android animation reduce stutter/choppy/lag-ThrowExceptions

Exception or error:

So I’ve been having animation issues especially when two animations happen at once or right when an activity loads. I understand it’s probably a resource problem and a lot of things are going on in the main thread causing the animations to stutter.

I’ve found a couple interesting suggestions:
1. Threads (ThreadPoolExecutor)
Here: How do I make my animation smoother Android
2. setDrawingCacheEnabled(true)
Here: How does Android's setDrawingCacheEnabled() work?
3. ViewGroup: animationCache = true

However I haven’t been able to find any sort of examples to implement these things. Any ideas?

How to solve:

I’ve reduced the amount of stutter on my animations by following these rules listed in order of importance when reducing stutter:

  1. Don’t initiate animations in onCreate, onStart or onResume.
  2. Initiate animations on user events such as onClick and disable touch events until animation is complete.
  3. Don’t initiate more than 2 animations simultaneously.

Leave a Reply

Your email address will not be published. Required fields are marked *