I have a png sequence that I want to display in an imageview. It has 745 frames of up to 44kb each and want to play it at 23 fps. Some of the frames have are different from the previous frame or are blank so I could skip updating on frames 100-243 and 340-400 for example. So the total size on disk ends up around 9mb (I only use need to use 249 images out of the 745 frames beacuase there are some pauses in the animation and some times the animation object goes off screen). All images are 320 x 480 and are scaled to fit the screen.
While it’s playing I need to do some other stuff along the way without stopping the animation.
I’m new to Java. In pseudocode I would like to do something like this :
The Activity loads…
For x = 1 to 745
if exsists("image" & x) then
imageview setbackground("image" & x) (change this every 35ms)
switch (x)
case: 10 then call a function at frame 10
case: 100 then call a function that vibrates 0.5sec at frame 100
case: 200 then call different function at frame 200
Loop
End the animation…
Then close the Activty.
So the question is how to do this on the Android?
I tried using an AnimationDrawable and an animationlist.xml array but get a Simulator VM Error if I have more than 40 frames.
I can get a little bit more to run on the actual device.
Any help to point me in the right direction would be apprieciated.
I ended up finding the solution I was looking for the Timed Loop although it does bring up a new issue regarding my frame rate requirements which I have included in a new question.
If you only need to update images every 70ms then this solution seems to work without the same memory restrictions as AnimationDrawable.
See new question at:
750 frame transparent PNG animation in ImageView at 23fps