I have 2 quiet large animations every 50pics 20kb Both are defined as Animations.xml
One I start from the beginning, and the second after pressing the button.
//Start immediatly imgView.setBackgroundResource(R.layout.anim1); rocketAnimation = (AnimationDrawable) imgView.getBackground(); //Start after button click imgView.setBackgroundResource(R.layout.anim2); rocketAnimation = (AnimationDrawable) imgView.getBackground();
It works fine until I press a button and assign a second animator to my view
08-22 14:56:03.886: DEBUG/AndroidRuntime(1541): Shutting down VM 08-22 14:56:03.886: WARN/dalvikvm(1541): threadid=3: thread exiting with uncaught exception (group=0x4001da28) 08-22 14:56:03.886: ERROR/AndroidRuntime(1541): Uncaught handler: thread main exiting due to uncaught exception 08-22 14:56:04.096: ERROR/AndroidRuntime(1541): java.lang.OutOfMemoryError: bitmap size exceeds VM budget 08-22 14:56:04.096: ERROR/AndroidRuntime(1541): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
It is clear that each animation is beautiful for itself (I could even set anim2 to autorun). but BOTH will exceed memory.
Btw. On my Nexus One, it works fine. Where it fails, on G1 1.6 (even in the simulator).
So HOW should I let go of the animation first before assigning anim2 ??
THX Chris
source share