public class CameraFragment
extends Fragment
Constructor and Description |
---|
CameraFragment() |
Modifier and Type | Method and Description |
---|---|
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().
|
int |
getDisplayOrientation() |
java.lang.String |
getFlashMode() |
CameraHost |
getHost() |
boolean |
isAutoFocusAvailable() |
boolean |
isRecording() |
void |
lockToLandscape(boolean enable)
Call this to lock the camera to landscape mode (with a
parameter of true), regardless of what the actual
screen orientation is.
|
View |
onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) |
void |
onPause() |
void |
onResume() |
void |
record()
Call this to begin recording video.
|
void |
restartPreview()
If you are in single-shot mode and are done processing
a previous picture, call this to restart the camera
preview.
|
protected void |
setCameraView(CameraView cameraView)
Use this if you are overriding onCreateView() and are
inflating a layout containing your CameraView, to tell
the fragment the CameraView, so the fragment can help
manage it.
|
void |
setHost(CameraHost host)
Call this (or override getHost()) to supply the
CameraHost used for most of the detailed interaction
with the camera.
|
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.
|
void |
stopRecording()
Call this to stop the recording triggered earlier by a
call to record()
|
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.
|
ZoomTransaction |
zoomTo(int level)
Call this to begin populating a ZoomTransaction, with
the eventual goal of changing the camera's zoom level.
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
public void onResume()
public void onPause()
protected void setCameraView(CameraView cameraView)
cameraView
- the CameraView from your inflated layoutpublic CameraHost getHost()
public void setHost(CameraHost host)
host
- a CameraHost instance, such as a subclass of
SimpleCameraHostpublic void takePicture()
public void takePicture(boolean needBitmap, boolean needByteArray)
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 otherwisepublic boolean isRecording()
public void record() throws java.lang.Exception
java.lang.Exception
- all sorts of things could go wrongpublic void stopRecording() throws java.lang.Exception
java.lang.Exception
- all sorts of things could go wrongpublic int getDisplayOrientation()
public void lockToLandscape(boolean enable)
enable
- true to lock the camera to landscape, false to
allow normal rotationpublic void autoFocus()
public void cancelAutoFocus()
public boolean isAutoFocusAvailable()
public void restartPreview()
public java.lang.String getFlashMode()
public ZoomTransaction zoomTo(int level)
level
- a value from 0 to getMaxZoom() (called on
Camera.Parameters), to indicate how tight the
zoom should be (0 indicates no zoom)public void startFaceDetection()
public void stopFaceDetection()