[android-developers] Re: canvas outside of onDraw()

2008-03-29 Thread Steve Oldmeadow
> Although now I'm having a problem of not being able to receive > onKeyDown messages for some reason! Probably because I need to check > input during my thread. any ideas/thoughts? You need to make the SurfaceView focusable. I do this in the Activity: myView.setFocusable(true); myView.setF

[android-developers] Re: canvas outside of onDraw()

2008-03-29 Thread tatagogo
Thanks for your replies. I found the SurfaceView mentioned in another discussion actually, shortly after posting my message earlier as luck would have it! Been implementing it and it seems to be just what is required, which is great! Thanks for your help!. Although now I'm having a problem of not

[android-developers] Re: canvas outside of onDraw()

2008-03-28 Thread Steve Oldmeadow
Is it a real time game? If so I'd suggest using a SurfaceView, you can grab a canvas from the SurfaceHolder and draw to it when you like. You can tick your game from a Handler. Alternatively you could draw into a Bitmap and then just draw the Bitmap in the onDraw(). --~--~-~--~~

[android-developers] Re: canvas outside of onDraw()

2008-03-28 Thread Diego Pino
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); }