0
votes

I'm new to creating animations on android.

I'm trying to create a large frame by frame animation using a lot of .png's.

I have two animations I need to play, with one of them being 100 frames big and another being 40.

I am currently using AnimationDrawable to create the animations however I am getting a "bitmap size exceeds VM budget" on any device with less than 1GB of ram (anything over that and it runs fine).

The 100 frame long animation is created with 78*334 sized images And the 40 frame animation is created with varying image sizes from 320*290 and 320*309.

I also need to be able to reverse the animations at random times (currently I just create another animation as necessary with the frames in reverse from the current frame and it works perfectly)

So I soppose my question is how can I create multiple frame by frame animations with lots of frames (or the appearance of an animation) without running out of memory on lower end devices.

2

2 Answers

2
votes

i had the same problem before, it was too painful to reduce memory usage while declaring an animation list as (in your case) 100frames*78px*334px*4bytes = 10,420,800 bytes if using uncompressed format. i used video instead of image sequnce i could use more video frames and resolution (in my case) 5sec*25fps*480px*854px on the the H.264 mp4 codec and it works like a charm :) no delay no overhead on sonxy xperia u 256mb of ram

0
votes

you can create multiple frame by frame animations in the android but only make sure your images(PNG)resolution is small...I have done this in my project with *320 * 480* resolution..its works perfect..but just one problem in that ,There is a loading time when you first start the animation depending upon your number of images...