English | Site Directory

Android - An Open Handset Alliance Project

android.hardware
public class

android.hardware.CameraDevice

java.lang.Object
android.hardware.CameraDevice

The CameraDevice class is used to open/release the camera driver, set image parameters and capture a preview frame (320*240 pixels) or a full-resolution image (1280*1024 pixels). This class does not have any public constructors. However, calling the static method open() will return a CameraDevice object. To get a frame/picture, follow these steps:

Nested Classes
CameraDevice.CaptureParams This class is used to set image parameters. 

Summary

Public Methods

        boolean  capture(Canvas canvas)
Method to capture an image/frame onto the canvas.
    final    void  close()
Method to release to the camera driver
    final  static  CameraDevice  open()
Static method to open the camera driver for exclusive use.
        boolean  setCaptureParams(CaptureParams captParams)
Method to set the parameters for image capture.
Methods inherited from class java.lang.Object

Details

Public Methods

public boolean capture(Canvas canvas)

Method to capture an image/frame onto the canvas.

Parameters

canvas The canvas onto which the image should be captured.

Returns

  • True if successful. False if image could not be captured.

public final void close()

Method to release to the camera driver

public static final CameraDevice open()

Static method to open the camera driver for exclusive use.

Returns

  • A CameraDevice object if driver could be opened for exclusive use. Else, null is returned.

public boolean setCaptureParams(CaptureParams captParams)

Method to set the parameters for image capture.

Parameters

captParams The parameters that need to be set for the capture. Refer to CaptureParams class for details.

Returns

  • True if succcessful. False if parameters could not be set.
Build m5-rc15i - 10 Jun 2008 13:54