Professional Documents
Culture Documents
Camera.Parameters|AndroidDevelopers
Design
Training
API Guides
Reference
Develop
Tools
Distribute
Google Services
Samples
public class
Preview
Camera.Parameters
extends Object
java.lang.Object
android.hardware.Camera.Parameters
Class Overview
Camera service settings.
To make camera parameters take effect, applications have to call setParameters(Camera.Parameters) .
For example, after setWhiteBalance(String) is called, white balance is not actually changed until
setParameters(Camera.Parameters) is called with the changed parameters object.
Different devices may have different camera capabilities, such as picture size or flash modes. The
application should query the camera capabilities before setting parameters. For example, the application
should call getSupportedColorEffects() before calling setColorEffect(String) . If the camera does
not support color effects, getSupportedColorEffects() will return null.
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
1/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Summary
Constants
String
ANTIBANDING_50HZ
String
ANTIBANDING_60HZ
String
ANTIBANDING_AUTO
String
ANTIBANDING_OFF
String
EFFECT_AQUA
String
EFFECT_BLACKBOARD
String
EFFECT_MONO
String
EFFECT_NEGATIVE
String
EFFECT_NONE
String
EFFECT_POSTERIZE
String
EFFECT_SEPIA
String
EFFECT_SOLARIZE
String
EFFECT_WHITEBOARD
String
FLASH_MODE_AUTO
String
FLASH_MODE_OFF
String
FLASH_MODE_ON
String
FLASH_MODE_RED_EYE
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
2/62
6/26/2015
Camera.Parameters|AndroidDevelopers
String
FLASH_MODE_TORCH
int
FOCUS_DISTANCE_FAR_INDEX
int
FOCUS_DISTANCE_NEAR_INDEX
int
FOCUS_DISTANCE_OPTIMAL_INDEX
String
FOCUS_MODE_AUTO
Auto-focus mode.
String
FOCUS_MODE_CONTINUOUS_PICTURE
String
FOCUS_MODE_CONTINUOUS_VIDEO
String
FOCUS_MODE_EDOF
String
FOCUS_MODE_FIXED
Focus is fixed.
String
FOCUS_MODE_INFINITY
String
FOCUS_MODE_MACRO
PREVIEW_FPS_MAX_INDEX
int
int
PREVIEW_FPS_MIN_INDEX
String
SCENE_MODE_ACTION
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
6/26/2015
Camera.Parameters|AndroidDevelopers
String
SCENE_MODE_AUTO
String
SCENE_MODE_BARCODE
String
SCENE_MODE_BEACH
String
SCENE_MODE_CANDLELIGHT
String
SCENE_MODE_FIREWORKS
String
SCENE_MODE_HDR
String
SCENE_MODE_LANDSCAPE
String
SCENE_MODE_NIGHT
String
SCENE_MODE_NIGHT_PORTRAIT
String
SCENE_MODE_PARTY
String
SCENE_MODE_PORTRAIT
String
SCENE_MODE_SNOW
String
SCENE_MODE_SPORTS
String
SCENE_MODE_STEADYPHOTO
String
SCENE_MODE_SUNSET
String
SCENE_MODE_THEATRE
String
WHITE_BALANCE_AUTO
String
WHITE_BALANCE_CLOUDY_DAYLIGHT
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
4/62
6/26/2015
Camera.Parameters|AndroidDevelopers
String
WHITE_BALANCE_DAYLIGHT
String
WHITE_BALANCE_FLUORESCENT
String
WHITE_BALANCE_INCANDESCENT
String
WHITE_BALANCE_SHADE
String
WHITE_BALANCE_TWILIGHT
String
WHITE_BALANCE_WARM_FLUORESCENT
Public Methods
String
flatten ()
Creates a single string with all the parameters set in this Parameters
object.
String
String
getAntibanding ()
Gets the current antibanding setting.
boolean
getAutoExposureLock ()
Gets the state of the auto-exposure lock.
boolean
getAutoWhiteBalanceLock ()
Gets the state of the auto-white balance lock.
String
getColorEffect ()
Gets the current color effect setting.
int
getExposureCompensation ()
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
5/62
6/26/2015
Camera.Parameters|AndroidDevelopers
getExposureCompensationStep ()
Gets the exposure compensation step.
String
getFlashMode ()
Gets the current flash mode setting.
float
getFocalLength ()
Gets the focal length (in millimeter) of the camera.
List<Camera.Area>
getFocusAreas ()
Gets the current focus areas.
void
String
getFocusMode ()
Gets the current focus mode setting.
float
getHorizontalViewAngle ()
Gets the horizontal angle of view in degrees.
int
int
getJpegQuality ()
Returns the quality setting for the JPEG picture.
int
getJpegThumbnailQuality ()
Returns the quality setting for the EXIF thumbnail in Jpeg picture.
Camera.Size
getJpegThumbnailSize ()
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
6/62
6/26/2015
Camera.Parameters|AndroidDevelopers
getMaxExposureCompensation ()
Gets the maximum exposure compensation index.
int
getMaxNumDetectedFaces ()
Gets the maximum number of detected faces supported.
int
getMaxNumFocusAreas ()
Gets the maximum number of focus areas supported.
int
getMaxNumMeteringAreas ()
Gets the maximum number of metering areas supported.
int
getMaxZoom ()
Gets the maximum zoom value allowed for snapshot.
List<Camera.Area>
getMeteringAreas ()
Gets the current metering areas.
int
getMinExposureCompensation ()
Gets the minimum exposure compensation index.
int
getPictureFormat ()
Returns the image format for pictures.
Camera.Size
getPictureSize ()
Returns the dimension setting for pictures.
Camera.Size
getPreferredPreviewSizeForVideo ()
Returns the preferred or recommended preview size (width and height) in
pixels for video recording.
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
7/62
6/26/2015
Camera.Parameters|AndroidDevelopers
int
getPreviewFormat ()
Returns the image format for preview frames got from
Camera.PreviewCallback .
void
int
getPreviewFrameRate ()
This method was deprecated in API level 9. replaced by
getPreviewFpsRange(int[])
Camera.Size
getPreviewSize ()
Returns the dimensions setting for preview pictures.
String
getSceneMode ()
Gets the current scene mode setting.
List<String>
getSupportedAntibanding ()
Gets the supported antibanding values.
List<String>
getSupportedColorEffects ()
Gets the supported color effects.
List<String>
getSupportedFlashModes ()
Gets the supported flash modes.
List<String>
getSupportedFocusModes ()
Gets the supported focus modes.
List<Camera.Size>
getSupportedJpegThumbnailSizes ()
Gets the supported jpeg thumbnail sizes.
List<Integer>
getSupportedPictureFormats ()
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
8/62
6/26/2015
Camera.Parameters|AndroidDevelopers
getSupportedPictureSizes ()
Gets the supported picture sizes.
List<Integer>
getSupportedPreviewFormats ()
Gets the supported preview formats.
List<int[]>
getSupportedPreviewFpsRange ()
Gets the supported preview fps (frame-per-second) ranges.
List<Integer>
getSupportedPreviewFrameRates ()
This method was deprecated in API level 9. replaced by
getSupportedPreviewFpsRange()
List<Camera.Size>
getSupportedPreviewSizes ()
Gets the supported preview sizes.
List<String>
getSupportedSceneModes ()
Gets the supported scene modes.
List<Camera.Size>
getSupportedVideoSizes ()
Gets the supported video frame sizes that can be used by
MediaRecorder.
List<String>
getSupportedWhiteBalance ()
Gets the supported white balance.
float
getVerticalViewAngle ()
Gets the vertical angle of view in degrees.
boolean
getVideoStabilization ()
Get the current state of video stabilization.
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
9/62
6/26/2015
Camera.Parameters|AndroidDevelopers
String
getWhiteBalance ()
Gets the current white balance setting.
int
getZoom ()
Gets current zoom value.
List<Integer>
getZoomRatios ()
Gets the zoom ratios of all zoom values.
boolean
isAutoExposureLockSupported ()
Returns true if auto-exposure locking is supported.
boolean
isAutoWhiteBalanceLockSupported ()
Returns true if auto-white balance locking is supported.
boolean
isSmoothZoomSupported ()
Returns true if smooth zoom is supported.
boolean
isVideoSnapshotSupported ()
Returns true if video snapshot is supported.
boolean
isVideoStabilizationSupported ()
Returns true if video stabilization is supported.
boolean
isZoomSupported ()
Returns true if zoom is supported.
void
void
removeGpsData ()
Removes GPS latitude, longitude, altitude, and timestamp from the
parameters.
void
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
10/62
6/26/2015
Camera.Parameters|AndroidDevelopers
void
void
void
void
void
void
void
void
void
void
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
11/62
6/26/2015
Camera.Parameters|AndroidDevelopers
void
void
void
void
void
void
void
void
void
void
void
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
12/62
6/26/2015
Camera.Parameters|AndroidDevelopers
void
void
void
void
void
void
void
void
void
Inherited Methods
[Expand]
13/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Constants
public static final String ANTIBANDING_50HZ
14/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Flash will be fired automatically when required. The flash may be fired during preview, auto-focus, or
snapshot depending on the driver.
Constant Value: "auto"
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
15/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Flash will always be fired during snapshot. The flash may also be fired during preview or auto-focus
depending on the driver.
Constant Value: "on"
Constant emission of light during preview, auto-focus and snapshot. This can also be used for video
recording.
Constant Value: "torch"
The array index of far focus distance for use with getFocusDistances(float[]) .
Constant Value: 2 (0x00000002)
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
16/62
6/26/2015
Camera.Parameters|AndroidDevelopers
The array index of near focus distance for use with getFocusDistances(float[]) .
Constant Value: 0 (0x00000000)
The array index of optimal focus distance for use with getFocusDistances(float[]) .
Constant Value: 1 (0x00000001)
Auto-focus mode. Applications should call autoFocus(AutoFocusCallback) to start the focus in this
mode.
Constant Value: "auto"
Continuous auto focus mode intended for taking pictures. The camera continuously tries to focus.
The speed of focus change is more aggressive than FOCUS_MODE_CONTINUOUS_VIDEO . Auto focus
starts when the parameter is set.
Applications can call autoFocus(AutoFocusCallback) in this mode. If the autofocus is in the middle
of scanning, the focus callback will return when it completes. If the autofocus is not scanning, the
focus callback will immediately return with a boolean that indicates whether the focus is sharp or not.
The apps can then decide if they want to take a picture immediately or to change the focus mode to
auto, and run a full autofocus cycle. The focus position is locked after autoFocus call. If applications
want to resume the continuous focus, cancelAutoFocus must be called. Restarting the preview will
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
17/62
6/26/2015
Camera.Parameters|AndroidDevelopers
not resume the continuous autofocus. To stop continuous focus, applications should change the
focus mode to other modes.
See Also
FOCUS_MODE_CONTINUOUS_VIDEO
Continuous auto focus mode intended for video recording. The camera continuously tries to focus.
This is the best choice for video recording because the focus changes smoothly . Applications still
can call takePicture(Camera.ShutterCallback,Camera.PictureCallback,
Camera.PictureCallback) in this mode but the subject may not be in focus. Auto focus starts when
Extended depth of field (EDOF). Focusing is done digitally and continuously. Applications should not
call autoFocus(AutoFocusCallback) in this mode.
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
18/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Focus is fixed. The camera is always in this mode if the focus is not adjustable. If the camera has
auto-focus, this mode can fix the focus, which is usually at hyperfocal distance. Applications should
not call autoFocus(AutoFocusCallback) in this mode.
Constant Value: "fixed"
Focus is set at infinity. Applications should not call autoFocus(AutoFocusCallback) in this mode.
Constant Value: "infinity"
Macro (close-up) focus mode. Applications should call autoFocus(AutoFocusCallback) to start the
focus in this mode.
Constant Value: "macro"
The array index of maximum preview fps for use with getPreviewFpsRange(int[]) or
getSupportedPreviewFpsRange() .
6/26/2015
Camera.Parameters|AndroidDevelopers
The array index of minimum preview fps for use with getPreviewFpsRange(int[]) or
getSupportedPreviewFpsRange() .
Applications are looking for a barcode. Camera driver will be optimized for barcode reading.
Constant Value: "barcode"
20/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Capture a scene using high dynamic range imaging techniques. The camera will return an image that
has an extended dynamic range compared to a regular capture. Capturing such an image may take
longer than a regular capture.
Constant Value: "hdr"
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
21/62
6/26/2015
Camera.Parameters|AndroidDevelopers
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
22/62
6/26/2015
Camera.Parameters|AndroidDevelopers
23/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Public Methods
public String flatten ()
Creates a single string with all the parameters set in this Parameters object.
The unflatten(String) method does the reverse.
Returns
a String with all values from this Parameters object, in semi-colon delimited key-value pairs
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
24/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Returns
the String value of the parameter
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
25/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Gets the state of the auto-white balance lock. Applications should check
isAutoWhiteBalanceLockSupported() before using this method. See
setAutoWhiteBalanceLock(boolean) for details about the lock.
Returns
State of the auto-white balance lock. Returns true if auto-white balance is currently locked, and false
otherwise.
See Also
setAutoWhiteBalanceLock(boolean)
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
26/62
6/26/2015
Camera.Parameters|AndroidDevelopers
EFFECT_WHITEBOARD
EFFECT_BLACKBOARD
EFFECT_AQUA
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
27/62
6/26/2015
Camera.Parameters|AndroidDevelopers
FLASH_MODE_AUTO
FLASH_MODE_ON
FLASH_MODE_RED_EYE
FLASH_MODE_TORCH
Gets the current focus areas. Camera driver uses the areas to decide focus.
Before using this API or setFocusAreas(List) , apps should call getMaxNumFocusAreas() to know
the maximum number of focus areas first. If the value is 0, focus area is not supported.
Each focus area is a rectangle with specified weight. The direction is relative to the sensor orientation,
that is, what the sensor sees. The direction is not affected by the rotation or mirroring of
setDisplayOrientation(int) . Coordinates of the rectangle range from -1000 to 1000. (-1000,
-1000) is the upper left point. (1000, 1000) is the lower right point. The width and height of focus
areas cannot be 0 or negative.
The weight must range from 1 to 1000. The weight should be interpreted as a per-pixel weight - all
pixels in the area have the specified weight. This means a small area with the same weight as a larger
area will have less influence on the focusing than the larger area. Focus areas can partially overlap
and the driver will add the weights in the overlap region.
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
28/62
6/26/2015
Camera.Parameters|AndroidDevelopers
A special case of a null focus area list means the driver is free to select focus targets as it wants.
For example, the driver may use more signals to select focus areas and change them dynamically.
Apps can set the focus area list to null if they want the driver to completely control focusing.
Focus areas are relative to the current field of view ( getZoom() ). No matter what the zoom level is,
(-1000,-1000) represents the top of the currently visible camera frame. The focus area cannot be set
to be outside the current field of view, even when using zoom.
Focus area only has effect if the current focus mode is FOCUS_MODE_AUTO , FOCUS_MODE_MACRO ,
FOCUS_MODE_CONTINUOUS_VIDEO , or FOCUS_MODE_CONTINUOUS_PICTURE .
Returns
a list of current focus areas
Gets the distances from the camera to where an object appears to be in focus. The object is sharpest
at the optimal focus distance. The depth of field is the far focus distance minus near focus distance.
Focus distances may change after calling autoFocus(AutoFocusCallback) , cancelAutoFocus() , or
startPreview() . Applications can call getParameters() and this method anytime to get the latest
29/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Parameters
output
focus distances in meters. output must be a float array with three elements. Near
focus distance, optimal focus distance, and far focus distance will be filled in the
array.
See Also
FOCUS_DISTANCE_NEAR_INDEX
FOCUS_DISTANCE_OPTIMAL_INDEX
FOCUS_DISTANCE_FAR_INDEX
FOCUS_MODE_MACRO.
See Also
FOCUS_MODE_AUTO
FOCUS_MODE_INFINITY
FOCUS_MODE_MACRO
FOCUS_MODE_FIXED
FOCUS_MODE_EDOF
FOCUS_MODE_CONTINUOUS_VIDEO
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
30/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Returns
the int value of the parameter
Returns the quality setting for the EXIF thumbnail in Jpeg picture.
Returns
the JPEG quality setting of the EXIF thumbnail.
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
31/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Gets the maximum number of detected faces supported. This is the maximum length of the list
returned from Camera.FaceDetectionListener . If the return value is 0, face detection of the
specified type is not supported.
Returns
the maximum number of detected face supported by the camera.
See Also
startFaceDetection()
Gets the maximum number of focus areas supported. This is the maximum length of the list in
setFocusAreas(List) and getFocusAreas() .
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
32/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Returns
the maximum number of focus areas supported by the camera.
See Also
getFocusAreas()
Gets the maximum number of metering areas supported. This is the maximum length of the list in
setMeteringAreas(List) and getMeteringAreas() .
Returns
the maximum number of metering areas supported by the camera.
See Also
getMeteringAreas()
Gets the maximum zoom value allowed for snapshot. This is the maximum value that applications
can set to setZoom(int) . Applications should call isZoomSupported() before using this method.
This value may change in different preview size. Applications should call this again after setting
preview size.
Returns
the maximum zoom value supported by the camera.
Gets the current metering areas. Camera driver uses these areas to decide exposure.
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
33/62
6/26/2015
Camera.Parameters|AndroidDevelopers
-1000) is the upper left point. (1000, 1000) is the lower right point. The width and height of metering
areas cannot be 0 or negative.
The weight must range from 1 to 1000, and represents a weight for every pixel in the area. This means
that a large metering area with the same weight as a smaller area will have more effect in the
metering result. Metering areas can partially overlap and the driver will add the weights in the overlap
region.
A special case of a null metering area list means the driver is free to meter as it chooses. For
example, the driver may use more signals to select metering areas and change them dynamically.
Apps can set the metering area list to null if they want the driver to completely control metering.
Metering areas are relative to the current field of view ( getZoom() ). No matter what the zoom level is,
(-1000,-1000) represents the top of the currently visible camera frame. The metering area cannot be
set to be outside the current field of view, even when using zoom.
No matter what metering areas are, the final exposure are compensated by
setExposureCompensation(int) .
Returns
a list of current metering areas
34/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Returns
minimum exposure compensation index (<=0). If both this method and
getMaxExposureCompensation() return 0, exposure compensation is not supported.
Returns the preferred or recommended preview size (width and height) in pixels for video recording.
Camcorder applications should set the preview size to a value that is not larger than the preferred
preview size. In other words, the product of the width and height of the preview size should not be
larger than that of the preferred preview size. In addition, we recommend to choose a preview size
that has the same aspect ratio as the resolution of video to be recorded.
Returns
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
35/62
6/26/2015
Camera.Parameters|AndroidDevelopers
the preferred preview size (width and height) in pixels for video recording if
getSupportedVideoSizes() does not return null; otherwise, null is returned.
See Also
getSupportedVideoSizes()
Returns the image format for preview frames got from Camera.PreviewCallback .
Returns
the preview format.
See Also
ImageFormat
setPreviewFormat(int)
Returns the current minimum and maximum preview fps. The values are one of the elements returned
by getSupportedPreviewFpsRange() .
Returns
range the minimum and maximum preview fps (scaled by 1000).
See Also
PREVIEW_FPS_MIN_INDEX
PREVIEW_FPS_MAX_INDEX
getSupportedPreviewFpsRange()
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
36/62
6/26/2015
Camera.Parameters|AndroidDevelopers
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
37/62
6/26/2015
Camera.Parameters|AndroidDevelopers
SCENE_MODE_LANDSCAPE
SCENE_MODE_NIGHT
SCENE_MODE_NIGHT_PORTRAIT
SCENE_MODE_THEATRE
SCENE_MODE_BEACH
SCENE_MODE_SNOW
SCENE_MODE_SUNSET
SCENE_MODE_STEADYPHOTO
SCENE_MODE_FIREWORKS
SCENE_MODE_SPORTS
SCENE_MODE_PARTY
SCENE_MODE_CANDLELIGHT
SCENE_MODE_BARCODE
38/62
6/26/2015
Camera.Parameters|AndroidDevelopers
39/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Returns
a list of Size object. This method will always return a list with at least two elements. Size 0,0 (no
thumbnail) is always supported.
Gets the supported preview formats. NV21 is always supported. YV12 is always supported since API
level 12.
Returns
a list of supported preview formats. This method will always return a list with at least one element.
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
40/62
6/26/2015
Camera.Parameters|AndroidDevelopers
See Also
ImageFormat
setPreviewFormat(int)
Gets the supported preview fps (frame-per-second) ranges. Each range contains a minimum fps and
maximum fps. If minimum fps equals to maximum fps, the camera outputs frames in fixed frame
rate. If not, the camera outputs frames in auto frame rate. The actual frame rate fluctuates between
the minimum and the maximum. The values are multiplied by 1000 and represented in integers. For
example, if frame rate is 26.623 frames per second, the value is 26623.
Returns
a list of supported preview fps ranges. This method returns a list with at least one element. Every
element is an int array of two values - minimum fps and maximum fps. The list is sorted from small
to large (first by maximum fps and then minimum fps).
See Also
PREVIEW_FPS_MIN_INDEX
PREVIEW_FPS_MAX_INDEX
41/62
6/26/2015
Camera.Parameters|AndroidDevelopers
a list of supported preview frame rates. null if preview frame rate setting is not supported.
Gets the supported video frame sizes that can be used by MediaRecorder.
If the returned list is not null, the returned list will contain at least one Size and one of the sizes in the
returned list must be passed to MediaRecorder.setVideoSize() for camcorder application if camera is
used as the video source. In this case, the size of the preview can be different from the resolution of
the recorded video during video recording.
Returns
a list of Size object if camera has separate preview and video output; otherwise, null is returned.
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
42/62
6/26/2015
Camera.Parameters|AndroidDevelopers
See Also
getPreferredPreviewSizeForVideo()
Get the current state of video stabilization. See setVideoStabilization(boolean) for details of
video stabilization.
Returns
true if video stabilization is enabled
See Also
isVideoStabilizationSupported()
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
43/62
6/26/2015
Camera.Parameters|AndroidDevelopers
setVideoStabilization(boolean)
Gets current zoom value. This also works when smooth zoom is in progress. Applications should
check isZoomSupported() before using this method.
Returns
the current zoom value. The range is 0 to getMaxZoom() . 0 means the camera is not zoomed.
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
44/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Gets the zoom ratios of all zoom values. Applications should check isZoomSupported() before using
this method.
Returns
the zoom ratios in 1/100 increments. Ex: a zoom of 3.2x is returned as 320. The number of
elements is getMaxZoom() + 1. The list is sorted from small to large. The first element is always
100. The last element is the zoom ratio of the maximum zoom value.
Returns true if auto-exposure locking is supported. Applications should call this before trying to lock
auto-exposure. See setAutoExposureLock(boolean) for details about the lock.
Returns
true if auto-exposure lock is supported.
See Also
setAutoExposureLock(boolean)
Returns true if auto-white balance locking is supported. Applications should call this before trying to
lock auto-white balance. See setAutoWhiteBalanceLock(boolean) for details about the lock.
Returns
true if auto-white balance lock is supported.
See Also
setAutoWhiteBalanceLock(boolean)
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
45/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Returns true if smooth zoom is supported. Applications should call this before using other smooth
zoom methods.
Returns
true if smooth zoom is supported.
Returns true if video snapshot is supported. That is, applications can call
takePicture(Camera.ShutterCallback,Camera.PictureCallback,Camera.PictureCallback,
Camera.PictureCallback) during recording. Applications do not need to call startPreview() after
taking a picture. The preview will be still active. Other than that, taking a picture during recording is
identical to taking a picture normally. All settings and methods related to takePicture work identically.
Ex: getPictureSize() , getSupportedPictureSizes() , setJpegQuality(int) ,
setRotation(int) , and etc. The picture will have an EXIF header. FLASH_MODE_AUTO and
FLASH_MODE_ON also still work, but the video will record the flash.
Applications can set shutter callback as null to avoid the shutter sound. It is also recommended to set
raw picture and post view callbacks to null to avoid the interrupt of preview display.
Field-of-view of the recorded video may be different from that of the captured pictures. The maximum
size of a video snapshot may be smaller than that for regular still captures. If the current picture size
is set higher than can be supported by video snapshot, the picture will be captured at the maximum
supported size instead.
Returns
true if video snapshot is supported.
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
46/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Returns true if zoom is supported. Applications should call this before using other zoom methods.
Returns
true if zoom is supported.
Removes GPS latitude, longitude, altitude, and timestamp from the parameters.
47/62
6/26/2015
Camera.Parameters|AndroidDevelopers
key
value
value
See Also
getAntibanding()
48/62
6/26/2015
Camera.Parameters|AndroidDevelopers
new state of the auto-exposure lock. True means that auto-exposure is locked, false
means that the auto-exposure routine is free to run normally.
See Also
getAutoExposureLock()
If set to true, the camera auto-white balance routine will immediately pause until the lock is set to
false.
If auto-white balance is already locked, setting this to true again has no effect (the driver will not
recalculate white balance values).
Stopping preview with stopPreview() , or triggering still image capture with
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
49/62
6/26/2015
Camera.Parameters|AndroidDevelopers
takePicture(Camera.ShutterCallback,Camera.PictureCallback,Camera.PictureCallback) , will
new state of the auto-white balance lock. True means that auto-white balance is
locked, false means that the auto-white balance routine is free to run normally.
See Also
getAutoWhiteBalanceLock()
setWhiteBalance(String)
See Also
getColorEffect()
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
50/62
6/26/2015
Camera.Parameters|AndroidDevelopers
flash mode.
See Also
getFlashMode()
See Also
getFocusAreas()
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
51/62
6/26/2015
Camera.Parameters|AndroidDevelopers
focus mode.
See Also
getFocusMode()
Sets GPS latitude coordinate. This will be stored in JPEG EXIF header.
Parameters
latitude
Sets GPS longitude coordinate. This will be stored in JPEG EXIF header.
Parameters
Developers
Develop
> Reference
> Camera.Parameters
GPS longitude coordinate.
longitude
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
52/62
6/26/2015
Android APIs
android
android.accessibilityservice
android.accounts
android.animation
Camera.Parameters|AndroidDevelopers
public
API
level: void
22
Console
setGpsProcessingMethod (String processing_method)
Sets GPS processing method. It will store up to 32 characters in JPEG EXIF header.
Parameters
processing_method
android.annotation
android.app
android.app.admin
android.app.backup
android.app.job
android.app.usage
Parameters
timestamp
android.appwidget
Interfaces
Camera.AutoFocusCallback
Camera.AutoFocusMoveCallback
Camera.ErrorCallback
the JPEG quality of captured picture. The range is 1 to 100, with 100 being the best.
Camera.FaceDetectionListener
Camera.OnZoomChangeListener
Camera.PictureCallback
Camera.PreviewCallback
Camera.ShutterCallback
Use Tree Navigation
the JPEG quality of the EXIF thumbnail. The range is 1 to 100, with 100 being the best.
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
53/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Sets the dimensions for EXIF thumbnail in Jpeg picture. If applications set both width and height to 0,
EXIF will not contain thumbnail.
Applications need to consider the display orientation. See setPreviewSize(int,int) for reference.
Parameters
width
height
See Also
setPreviewSize(int,int)
See Also
getMeteringAreas()
See Also
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
54/62
6/26/2015
Camera.Parameters|AndroidDevelopers
ImageFormat
height
See Also
setPreviewSize(int,int)
55/62
6/26/2015
Camera.Parameters|AndroidDevelopers
yStride=(int)ceil(width/16.0)*16;
uvStride=(int)ceil((yStride/2)/16.0)*16;
ySize=yStride*height;
uvSize=uvStride*height/2;
yRowIndex=yStride*y;
uRowIndex=ySize+uvSize+uvStride*c;
vRowIndex=ySize+uvStride*c;
size=ySize+uvSize*2;
Parameters
pixel_format
See Also
ImageFormat
getSupportedPreviewFormats()
Sets the minimum and maximum preview fps. This controls the rate of preview frames received in
Camera.PreviewCallback . The minimum and maximum preview fps must be one of the elements
from getSupportedPreviewFpsRange() .
Parameters
min
max
Throws
RuntimeException
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
56/62
6/26/2015
Camera.Parameters|AndroidDevelopers
See Also
setPreviewCallbackWithBuffer(Camera.PreviewCallback)
getSupportedPreviewFpsRange()
Sets the dimensions for preview pictures. If the preview has already started, applications should stop
the preview first before changing preview size. The sides of width and height are based on camera
orientation. That is, the preview size is the size before it is rotated by display orientation. So
applications need to consider the display orientation while setting preview size. For example, suppose
the camera supports both 480x320 and 320x480 preview sizes. The application wants a 3:2 preview
ratio. If the display orientation is set to 0 or 180, preview size should be set to 480x320. If the display
orientation is set to 90 or 270, preview size should be set to 320x480. The display orientation should
also be considered while setting picture size and thumbnail size.
Parameters
width
height
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
57/62
6/26/2015
Camera.Parameters|AndroidDevelopers
See Also
setDisplayOrientation(int)
getCameraInfo(int,CameraInfo)
setPictureSize(int,int)
setJpegThumbnailSize(int,int)
Sets recording mode hint. This tells the camera that the intent of the application is to record videos
start() , not to take still pictures takePicture(Camera.ShutterCallback,
Camera.PictureCallback,Camera.PictureCallback,Camera.PictureCallback) . Using this hint
can allow MediaRecorder.start() to start faster or with fewer glitches on output. This should be called
before starting preview for the best result, but can be changed while the preview is active. The default
value is false. The app can still call takePicture() when the hint is true or call MediaRecorder.start()
when the hint is false. But the performance may be worse.
Parameters
hint
Sets the clockwise rotation angle in degrees relative to the orientation of the camera. This affects the
pictures returned from JPEG Camera.PictureCallback . The camera driver may set orientation in the
EXIF header without rotating the picture. Or the driver may rotate the picture and the EXIF thumbnail. If
the Jpeg picture is rotated, the orientation in the EXIF header will be missing or 1 (row #0 is top and
column #0 is left side).
If applications want to rotate the picture to match the orientation of what users see, apps should use
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
58/62
6/26/2015
Camera.Parameters|AndroidDevelopers
relative to the natural orientation of the device. CameraInfo.orientation is the angle between camera
orientation and natural device orientation. The sum of the two is the rotation angle for back-facing
camera. The difference of the two is the rotation angle for front-facing camera. Note that the JPEG
pictures of front-facing cameras are not mirrored as in preview display.
For example, suppose the natural orientation of the device is portrait. The device is rotated 270
degrees clockwise, so the device orientation is 270. Suppose a back-facing camera sensor is
mounted in landscape and the top side of the camera sensor is aligned with the right edge of the
display in natural orientation. So the camera orientation is 90. The rotation should be set to 0 (270 +
90).
The reference code is as follows.
publicvoidonOrientationChanged(intorientation){
if(orientation==ORIENTATION_UNKNOWN)return;
android.hardware.Camera.CameraInfoinfo=
newandroid.hardware.Camera.CameraInfo();
android.hardware.Camera.getCameraInfo(cameraId,info);
orientation=(orientation+45)/90*90;
introtation=0;
if(info.facing==CameraInfo.CAMERA_FACING_FRONT){
rotation=(info.orientationorientation+360)%360;
}else{//backfacingcamera
rotation=(info.orientation+orientation)%360;
}
mParameters.setRotation(rotation);
}
Parameters
rotation
The rotation angle in degrees relative to the orientation of the camera. Rotation can
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
59/62
6/26/2015
Camera.Parameters|AndroidDevelopers
See Also
OrientationEventListener
getCameraInfo(int,CameraInfo)
Sets the scene mode. Changing scene mode may override other parameters (such as flash mode,
focus mode, white balance). For example, suppose originally flash mode is on and supported flash
modes are on/off. In night scene mode, both flash mode and supported flash mode may be changed
to off. After setting scene mode, applications should call getParameters to know if some parameters
are changed.
Parameters
value
scene mode.
See Also
getSceneMode()
60/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Set to true to enable video stabilization, and false to disable video stabilization.
See Also
isVideoStabilizationSupported()
getVideoStabilization()
Sets the white balance. Changing the setting will release the auto-white balance lock. It is
recommended not to change white balance and AWB lock at the same time.
Parameters
value
See Also
getWhiteBalance()
setAutoWhiteBalanceLock(boolean)
Sets current zoom value. If the camera is zoomed (value > 0), the actual picture size may be smaller
than picture size setting. Applications can check the actual picture size after picture is returned from
Camera.PictureCallback . The preview size remains the same in zoom. Applications should check
isZoomSupported() before using this method.
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
61/62
6/26/2015
Camera.Parameters|AndroidDevelopers
Parameters
value
Takes a flattened string of parameters and adds each one to this Parameters object.
The flatten() method does the reverse.
Parameters
flattened
Blog Support
Except as noted, this content is licensed under Apache 2.0. For details and restrictions, see the Content License.
Android 5.1r1 24 Jun 2015 22:05
About Android | Auto | TV | Wear | Legal
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFrameRate(int)
English
62/62