-1

I am in an Activity which must play an AnimationDrawable (a 'loading' animation) while the rest of the content loads. I started the animation in another thread since animations tend to give a lot of work to the main thread, however the animation can't be displayed correctly, and the Logcat shows several times to have skipped 40 frames or so. I'll post the code tomorrow, sorry for the delay. Meanwhile what can be causing this? all the thread has inside is the start method for the animation drawable.

OrangeWall
  • 79
  • 1
  • 8

1 Answers1

0

You should not run animation off of the UI thread ("main" thread) - you should load your content in another thread by using a Loader (or something similar) and play the animation on the UI thread. That's what it's for.

Here are official thread guidelines:

Do not block the UI thread

Do not access the Android UI toolkit from outside the UI thread

More here

Community
  • 1
  • 1
C0D3LIC1OU5
  • 8,600
  • 2
  • 37
  • 47