views:

24

answers:

0

Hello. I'm working on a game that requires drawing to SurfaceView's Canvas. I'm using SurfaceHolder to obtain Canvas to draw to, and perform drawing in a separate thread. Everything I draw displays correctly except for this one animation.

Here is the animation definition (it is in res/drawable/ my_animation.xml:

and here is how I draw it to the Canvas:

AnimationDrawable ad = (AnimationDrawable)getResources().getDrawable(R.drawable.my_animation); ad.draw(canvas); ad.start();

but only the first frame ever appears on the screen.

What am I missing?

Thank you