Code example for SurfaceView

Methods: getHolder

0
 
    public CameraPreview(Context context, Camera camera, SurfaceView filtered) {
        super(context);
        mCamera = camera;
        mFiltered = filtered;
        mFiltered.getHolder().setFormat(ImageFormat.YV12);
 
        previewData = new byte[640*480 + 320*240*2];
 
        // Install a SurfaceHolder.Callback so we get notified when the 
        // underlying surface is created and destroyed. 
        mHolder = getHolder();
        mHolder.addCallback(this);
 
    } 
 
    public void onPreviewFrame(byte[] data, Camera camera) {
        if (mFiltered.getHolder().getSurface().isValid()) {
            processFrame(data, mFiltered.getHolder().getSurface());
            /* 
Contextual code suggestions in your IDE  Get Codota for Java