1

I need to use animations in the app. Is it better to use frame-to-frame ImageView animations or to use video animations? Video animations are SWF (which I can probably convert to mp4).

The animations last up to 4s what would be around 80 images in one frame-to-frame animation. This is the layout of the app.

A different animation will appear in the red area based on which button on the right side is pressed.

Now, which approach is best to use?

  • I know that frame-to-frame approach may create an app with a lot of MBs.

  • I also do not know if video approach could make smooth animations? Can I play SWF files inside the such layout or I would have to convert each into mp4 in order to use this app on pre-Android-2.2 mobile phones.

Please advise!

sandalone
  • 41,141
  • 63
  • 222
  • 338
  • refer this http://stackoverflow.com/questions/2785336/starting-frame-by-frame-animation I hope it helps you. Thanks. – anddev Feb 07 '12 at 09:05
  • @MansiVora Hm, this does not answer my question. I know how to implement frame-by-frame (it's easy) but I do not now should I use it or video file? – sandalone Feb 07 '12 at 11:49

1 Answers1

2

For an ImageView, I assume you will be doing the animation by repeatedly calling the invalidate method. This will not give you a high frame rate. To do real-time animation, you need a SurfaceView or subclass thereof, perhaps a VideoView.

Lawrence D'Oliveiro
  • 2,768
  • 1
  • 15
  • 13
  • In XML I set the resource with each image and its duration. Then in code I just setDrawable for ImageView. I do not think I'd need SurfaceView for this. – sandalone Feb 07 '12 at 13:28