title: How to place AnimationDrawable on a SurfaceView canvas
body: <p>Noob to game development and I'm having trouble placing an AnimationDrawable onto a SurfaceView canvas. It's part of a simple game, user touches screen and an animated gif is placed at that location that looks like an explosion. I can accomplish this with a Bitmap using the code shown below, but converting this to an AnimationDrawable is where I'm stuck. I could create the AnimationDrawable from an ImageView, but I can't find a way to get the ImageView onto the canvas either...</p>
  
  <p>Am I going about this in the wrong way? Is there a simpler way to get an animated gif to display at an x,y coordinate on a SurfaceView's canvas?</p>
  
  <pre><code>Bitmap explodeBmp = BitmapFactory.decodeResource(getResources(), R.drawable.explode4);
  canvas.drawBitmap(explodeBmp, coords.getX()-(explodeBmp.getWidth()/2), coords.getY()-(explodeBmp.getHeight()/2), paint);
  </code></pre>
  
  <p>This throws a ClassCastException if I try to convert the Bitmap to an AnimationDrawable and start it:</p>
  
  <pre><code>AnimationDrawable explosionAnimation = (AnimationDrawable) ((Drawable) new BitmapDrawable(explodeBmp));
  explosionAnimation.start();
  </code></pre>