本人创建了public class GameControl extends SurfaceView implements SurfaceHolder.Callback 类
用来控制游戏界面的切换  但是当切换界面时 怎么就调用了surfaceDestroy? 于是画图线程里的
canvas = surfaceHolder.lockCanvas()为空,求高手指教!!! 
 

解决方案 »

  1.   

    The Surface will be created for you while the SurfaceView's window is visible; you should implement surfaceCreated(SurfaceHolder) and surfaceDestroyed(SurfaceHolder) to discover when the Surface is created and destroyed as the window is shown and hidden. 
    SDK说当SurfaceView's window隐藏时,就会调用surfaceDestroyed了。