当activity离开了前台,surfaceview会被销毁; 当activity回到前台,surfaceview又会被重新创建, 创建是发生在onResume()方法之后。
通过注册回调函数来监听surfaceview的各种zhuangtsurfaceView.getHolder().addCallback(new SurfaceCallback());
private final class SurfaceCallback implements Callback{
public void surfaceViewChanged(SurfaceHolder holder,int format,int width){}
public void surfaceViewCreated(SurfaceHolder holder){}
public void surfaceDestroyed(SurfaceHolder holder){}
}