hi all,
I am working with fullscreen handwrite trace drawing,
want to use SurfaceView and Thread to make drawing fast, like
LunarLander.
but the canvas is always null:
public void run(){
            while (mRun) {
                Canvas c = null;
                try {
                    c = mSurfaceHolder.lockCanvas(null); //c is always
null! why???
                    synchronized (mSurfaceHolder) {
                        //if (mMode == STATE_RUNNING) updatePhysics();
                        doDraw(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) {
                        mSurfaceHolder.unlockCanvasAndPost(c);
                    }
                }
            }
}

surfaceCreated has been called before this.

anybody know why the canvas is alway null?

the different between my app and LunarLander is that my SurfaceView is
the view of PopupWindow.

Can SurfaceView be the view of PopupWindow?

-- 
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to