Lines Matching refs:Camera
20 import android.hardware.Camera;
31 * Camera related utilities.
39 * Iterate over supported camera video sizes to see which one best fits the
43 * @param supportedVideoSizes Supported camera video sizes.
44 * @param previewSizes Supported camera preview sizes.
47 * @return Best match camera video size to fit in the view.
49 public static Camera.Size getOptimalVideoSize(List<Camera.Size> supportedVideoSizes,
50 List<Camera.Size> previewSizes, int w, int h) {
57 List<Camera.Size> videoSizes;
63 Camera.Size optimalSize = null;
66 // minimum difference between view and camera height.
75 for (Camera.Size size : videoSizes) {
88 for (Camera.Size size : videoSizes) {
99 * @return the default camera on the device. Return null if there is no camera on the device.
101 public static Camera getDefaultCameraInstance() {
102 return Camera.open();
107 * @return the default rear/back facing camera on the device. Returns null if camera is not
110 public static Camera getDefaultBackFacingCameraInstance() {
111 return getDefaultCamera(Camera.CameraInfo.CAMERA_FACING_BACK);
115 * @return the default front facing camera on the device. Returns null if camera is not
118 public static Camera getDefaultFrontFacingCameraInstance() {
119 return getDefaultCamera(Camera.CameraInfo.CAMERA_FACING_FRONT);
125 * @param position Physical position of the camera i.e Camera.CameraInfo.CAMERA_FACING_FRONT
126 * or Camera.CameraInfo.CAMERA_FACING_BACK.
127 * @return the default camera on the device. Returns null if camera is not available.
130 private static Camera getDefaultCamera(int position) {
132 int mNumberOfCameras = Camera.getNumberOfCameras();
134 // Find the ID of the back-facing ("default") camera
135 Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
137 Camera.getCameraInfo(i, cameraInfo);
139 return Camera.open(i);