0

I have a fragment and have a layout which has multiple views - around 15 to 20, which will be updated every second with values. And I have a GIF animation running amidst of all these views. This animation is being very slow and does not run smoothly; that said, this animation stops a bit and runs again while other 15 to 20 views are being updated. This really makes animation look very non smooth.

All these views are being updated in same UI thread.

Could you please tell how should I update animation independent of other views so that it runs smoothly.

Thanks.

user2879697
  • 69
  • 1
  • 10
  • With that much animation, maybe you should consider migrating to any suitable API Android natively supports? https://developer.android.com/guide/topics/graphics/2d-graphics.html – Mark Sep 28 '16 at 07:17
  • Out of 15 views, around 10 views are drawn on canvas. Even animation is drawn in canvas. – user2879697 Sep 28 '16 at 07:50
  • And these canvas-drawn animations are smooth or not? – Mark Sep 28 '16 at 07:54
  • Among those, only one view is animation. Rest all views are canvas-drawn but not animations. And they will be updated every second. Apart from that animation other all updates are smooth. – user2879697 Sep 28 '16 at 08:55
  • Ok, just to be clear. GIF is your only animation? – Mark Sep 28 '16 at 09:02
  • Yes, GIF is the only animation. – user2879697 Sep 28 '16 at 09:25
  • I'd recommend replacing GIF animation with sample one using canvas (may be a ball going up and down), just to test if it would be smooth or not. If yes, maybe you should consider changing your gif into canvas animation (if possible) or implementing it differently (there are many examples here http://stackoverflow.com/questions/3660209/display-animated-gif - they might be worth trying) – Mark Sep 28 '16 at 09:34
  • FYI, I'm using android.graphics.Movie for playing GIF as specified in the link you provided. But it isn't helping. I'll check with sample one as specified by you and see if it helps. – user2879697 Sep 28 '16 at 09:43

0 Answers0