Hello,

I'm fairly new to Android development, and having a couple of
questions concerning extending the Drawable class. I see that the draw
method has an abstract modifier. However, while looking at the Lunar
Lander example code, I noticed that several of the images being drawn
to the screen are of the Drawable type. How is this possible, since
the draw method is abstract?

Also, I tried extending the Drawable class into a Sprite class to
handle some additional properties and methods I need for a video game,
but I get a runtime ClassCastException error whenever I try to get a
Drawable resource from my Resources and cast it as a Sprite, like so:

private Sprite mSpriteImage;
mSpriteImage = (Sprite) context.getResources().getDrawable
(R.drawable.testSprite);

How would I go about making this work?

Thanks.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to