Hi guys,
I've created a separate class for an object I want to draw on a View
with something like:
public void Draw(Canvas canvas){
this.mImage.setBounds(this.coordX, this.coordY, this.coordX +
this.mImageWidth, this.coordY
+ this.mImageHeight);
this.mImage.draw(canvas);
}
which works fine. It is not extending any Views, though, as this is
just a logical unit on the app.
However, I want to run a 3 frame animation rather than just rendering
the image, so I tried the following:
1) Created a AnimationDrawable member on that same class:
AnimationDrawable aAnimate;
2) Loaded my animation to the Drawable member from the xml file on the
constructor with:
this.mImage = context.getResources().getDrawable(
R.anim.test2);
3) Created a reference to the AnimationDrawable on the constructor
with:
this.aAnimate = (AnimationDrawable)this.mImage;
4) Changed the Draw() method to:
public void Draw(Canvas canvas){
this.mImage.setBounds(this.coordX, this.coordY, this.coordX +
this.mImageWidth, this.coordY
+ this.mImageHeight);
this.aAnimate.start();
//this.mImage.draw(canvas);
}
But the Drawable does not even appear on the screen (I have logged the
execution so I know that I am getting to the start()).
Any clues/help possible from the gurus out there?
Many thanks
Cass
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---