Hi Jason,

Thanks for the reply. It's quite difficult to post code as there's a
whole bunch of APIs I've ported over from JavaME that make up what's
going on. I am going to try and whittle everything down to a simple
test case.

The basic 'draw' loop is the same as in the 'Lunar Lander' source,
repeat the following within a 'run' loop...

private final void drawToScreen(Rect rect)
{
        android.graphics.Canvas c = null;
        try
        {
                //
                // get a surface to draw on and notify that drawing is about to
begin
                //
                c = getHolder().lockCanvas(null);
                synchronized (getHolder())
                {
                        // do the drawing
                        onDraw(c);
                }
        }
        finally
        {
                // do this in a finally so that if an exception is thrown
                // during the above, we don't leave the Surface in an
                // inconsistent state
                if (c != null)
                {
                        // ok - we've finishsed drawing
                        getHolder().unlockCanvasAndPost(c);
                }
        }
}

-- 
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