android.hardware.Camera
The Camera class is used to connect/disconnect with the camera service,
set capture settings, start/stop preview, snap a picture, and retrieve
frames for encoding for video.
There is no default constructor for this class. Use open() to
get a Camera object.
Nested Classes
Summary
Constants
Public Methods
Protected Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Constants
public
static
final
int
CAMERA_ERROR_SERVER_DIED
Media server died. In this case, the application must release the
Camera object and instantiate a new one. @see #ErrorCallback
Constant Value:
100
(0x00000064)
public
static
final
int
CAMERA_ERROR_UNKNOWN
Unspecified camerar error. @see #ErrorCallback
Constant Value:
1
(0x00000001)
Public Methods
Registers a callback to be invoked when the auto focus responds.
Returns the picture Parameters for this Camera service.
public
static
Camera
open()
Returns a new Camera object.
public
final
void
release()
Disconnects and releases the Camera object resources.
It is recommended that you call this as soon as you're done with the
Camera object.
Registers a callback to be invoked when an error occurs.
Sets the Parameters for pictures from this Camera service.
Parameters
params
| the Parameters to use for this Camera service
|
Can be called at any time to instruct the camera to use a callback for
each preview frame in addition to displaying it.
Parameters
cb
| A callback object that receives a copy of each preview frame.
Pass null to stop receiving callbacks at any time.
|
public
final
void
setPreviewDisplay(SurfaceHolder holder)
Sets the SurfaceHolder to be used for a picture preview. If the surface
changed since the last call, the screen will blank. Nothing happens
if the same surface is re-set.
Parameters
holder
| the SurfaceHolder upon which to place the picture preview
|
public
final
void
startPreview()
Start drawing preview frames to the surface.
public
final
void
stopPreview()
Stop drawing preview frames to the surface.
Registers a callback to be invoked when a picture is taken.
Parameters
raw
| the callback to run for raw images, may be null |
jpeg
| the callback to run for jpeg images, may be null
|
Protected Methods
protected
void
finalize()
Called by the virtual machine when there are no longer any (non-weak)
references to the receiver. Subclasses can use this facility to guarantee
that any associated resources are cleaned up before the receiver is
garbage collected. Uncaught exceptions which are thrown during the
running of the method cause it to terminate immediately, but are
otherwise ignored.
Note: The virtual machine assumes that the implementation in class Object
is empty.