I suggest you to define a draw(Canvas canvas) method for the other
classes you also need to render. For example, you got a View an a
object Menu, you could do something like this,
class MyView extends view {
Menu mMenu;
public doSomething(Canvas, ...) {
mMenu.draw(canvas);
}
public void onDraw(Canvas canvas) {
doSomething(canvas);
}
}
class Menu {
public void draw(Canvas canvas) {
canvas.drawBitmap(...);
}
}
br
On Mar 28, 8:19 pm, tatagogo <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm currently trying to port an existing game from J2ME to android,
> which is proving to be a little fiddly although quite possible really
> I think. However, I seem to have a problem when drawing things outside
> of the onDraw() method. I have a couple of other methods which I call
> from within onDraw() on occasion (for example, when I have some extra
> menu graphics to draw) which attempt to draw to the canvas... which
> isn't visible from that method. How can I make the same canvas
> reference visible from that method?
>
> I'm a bit inexperienced with java really, so I'm hoping there's a
> simple solution or workaround that I'm just not aware of... I'd hate
> to have to move all the code into the onDraw() block really!
>
> Anyway, any tips or suggestions would be appreciated. Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---