SetbackgroundResource from xml crashes VM, Out of memory. How can i optimise this?-Collection of common programming errors

I am currently making a small application in Android. My wish is to have two ImageViews that change their animation when i click different buttons on the screen.

First a sample xml: (the drawables are 250x350y .png files)



    
    
    
    

Example of my code

ImageView _imgView1; //declared in oncreate = ((ImageView) findViewById... etc)
AnimationDrawable _aniDrawable1;

OnResume:

_imgView1.setBackgroundResource(R.drawable.anim_main_idle);
_aniDrawable1 = (AnimationDrawable) _imgView1.getBackground();
_aniDrawable1.start();

So far this works, and there are no issues. The little sprite does it’s jig. I am however doing this to two imageViews at a time, and I’ve been trying to add more/different “frames” in the XML for each. However, i do not have to add many frames, before the VM crashes because it’s out of memory.

It seems to me as if it’s making a bmp out of each drawable mentioned in the XML, and then binding this in the VM memmory when i call “setBackgroundResource”.

My question: Is there any way to make this less memmory intensive? Can i change how .setBackgroundResource saves the data from the XML? 7-8 different pictures like the one in my xml is enough to break a 16MB VM. I dont want much, i just want a few frames of animation running side by side that change when i click buttons, but that seems prettymuch impossible if AnimationDrawable eats so much out of the VM-memmory.

Hints? ideas? alternatives?