Code example for Camera.PreviewCallback

Methods: onPreviewFrame

1
    public void onPreviewFrame(byte[] data, Camera unused) {
      Preconditions.checkNotNull(camera);
      Preconditions.checkArgument(data == previewBuffer);
      Preconditions.checkState(yuvImage.compressToJpeg(rect, 80, stream));
      if (previewCallback != null) {
        previewCallback.onPreviewFrame(stream.toByteArray(), camera);
        stream.reset();
      } 
      camera.addCallbackBuffer(previewBuffer);
    } 
  } 
 
  private final class SurfaceHolderCallback implements SurfaceHolder.Callback {
    @Override 
    public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
    } 
 
    @Override 
    public void surfaceCreated(SurfaceHolder holder) {
      try { 
Contextual code suggestions in your IDE  Get Codota for Java