Class CameraFragment
-
- All Implemented Interfaces:
public class CameraFragment
Primary class for using `CameraView` as a fragment. Just add this as a fragment, no different than any other fragment that you might use, and it will handle the camera preview, plus give you controls to take pictures, etc.
-
-
Constructor Summary
Constructors Constructor Description CameraFragment()
-
Method Summary
Modifier and Type Method Description View
onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
void
onResume()
void
onPause()
CameraHost
getCameraHost()
void
setCameraHost(CameraHost host)
Call this (or override getCameraHost()) to supply the CameraHost used for most of the detailed interaction with the camera. void
takePicture()
Call this to take a picture and get access to a byte array of data as a result (e.g., to save or stream). void
takePicture(boolean needBitmap, boolean needByteArray)
Call this to take a picture. void
takePicture(PictureTransaction xact)
Call this to take a picture. boolean
isRecording()
void
record()
Call this to begin recording video. void
stopRecording()
Call this to stop the recording triggered earlier by a call to record() int
getDisplayOrientation()
void
lockToLandscape()
Call this to lock the camera to landscape mode (with a parameter of true), regardless of what the actual screen orientation is. void
unlocklockOrientation()
Call this to set the camera to unspecified orientation mode. void
autoFocus()
Call this to begin an auto-focus operation (e.g., in response to the user tapping something to focus the camera). void
cancelAutoFocus()
Call this to cancel an auto-focus operation that had been started via a call to autoFocus(). boolean
isAutoFocusAvailable()
void
restartPreview()
If you are in single-shot mode and are done processing a previous picture, call this to restart the camera preview. String
getFlashMode()
ZoomTransaction
zoomTo(int level)
Call this to begin populating a ZoomTransaction, with the eventual goal of changing the camera's zoom level. void
startFaceDetection()
Calls startFaceDetection() on the CameraView, which in turn calls startFaceDetection() on the underlying camera. void
stopFaceDetection()
Calls stopFaceDetection() on the CameraView, which in turn calls startFaceDetection() on the underlying camera. boolean
doesZoomReallyWork()
void
setFlashMode(String mode)
-
-
Method Detail
-
onCreateView
View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
-
onResume
void onResume()
-
onPause
void onPause()
-
getCameraHost
CameraHost getCameraHost()
-
setCameraHost
void setCameraHost(CameraHost host)
Call this (or override getCameraHost()) to supply the CameraHost used for most of the detailed interaction with the camera.
- Parameters:
host
- a CameraHost instance, such as a subclass of SimpleCameraHost
-
takePicture
void takePicture()
Call this to take a picture and get access to a byte array of data as a result (e.g., to save or stream).
-
takePicture
void takePicture(boolean needBitmap, boolean needByteArray)
Call this to take a picture.
- Parameters:
needBitmap
- true if you need to be passed a Bitmap result, false otherwiseneedByteArray
- true if you need to be passed a byte array result, false otherwise
-
takePicture
void takePicture(PictureTransaction xact)
Call this to take a picture.
- Parameters:
xact
- PictureTransaction with configuration data for the picture to be taken
-
isRecording
boolean isRecording()
-
record
void record()
Call this to begin recording video.
-
stopRecording
void stopRecording()
Call this to stop the recording triggered earlier by a call to record()
-
getDisplayOrientation
int getDisplayOrientation()
-
lockToLandscape
void lockToLandscape()
Call this to lock the camera to landscape mode (with a parameter of true), regardless of what the actual screen orientation is.
-
unlocklockOrientation
void unlocklockOrientation()
Call this to set the camera to unspecified orientation mode.
-
autoFocus
void autoFocus()
Call this to begin an auto-focus operation (e.g., in response to the user tapping something to focus the camera).
-
cancelAutoFocus
void cancelAutoFocus()
Call this to cancel an auto-focus operation that had been started via a call to autoFocus().
-
isAutoFocusAvailable
boolean isAutoFocusAvailable()
-
restartPreview
void restartPreview()
If you are in single-shot mode and are done processing a previous picture, call this to restart the camera preview.
-
getFlashMode
String getFlashMode()
-
zoomTo
ZoomTransaction zoomTo(int level)
Call this to begin populating a ZoomTransaction, with the eventual goal of changing the camera's zoom level.
- Parameters:
level
- a value from 0 to getMaxZoom() (called on Camera.
-
startFaceDetection
void startFaceDetection()
Calls startFaceDetection() on the CameraView, which in turn calls startFaceDetection() on the underlying camera.
-
stopFaceDetection
void stopFaceDetection()
Calls stopFaceDetection() on the CameraView, which in turn calls startFaceDetection() on the underlying camera.
-
doesZoomReallyWork
boolean doesZoomReallyWork()
-
setFlashMode
void setFlashMode(String mode)
-
-
-
-