Most visited

Recently visited

Added in API level 1
Deprecated since API level 21


public static interface Camera.PreviewCallback


This interface was deprecated in API level 21.
We recommend using the new android.hardware.camera2 API for new applications.

Callback interface used to deliver copies of preview frames as they are displayed.

See also:


Public methods

abstract void onPreviewFrame(byte[] data, Camera camera)

Called as preview frames are displayed.

Public methods


Added in API level 1
void onPreviewFrame (byte[] data, 
                Camera camera)

Called as preview frames are displayed. This callback is invoked on the event thread open(int) was called from.

If using the YV12 format, refer to the equations in setPreviewFormat(int) for the arrangement of the pixel data in the preview callback buffers.

data byte: the contents of the preview frame in the format defined by ImageFormat, which can be queried with getPreviewFormat(). If setPreviewFormat(int) is never called, the default will be the YCbCr_420_SP (NV21) format.
camera Camera: the Camera service object.