Java Code Examples for android.hardware.Camera#getParameters()
The following examples show how to use
android.hardware.Camera#getParameters() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CameraConfigurationManager.java From barterli_android with Apache License 2.0 | 6 votes |
/** * Reads, one time, values from the camera that are needed by the app. */ void initFromCameraParameters(Camera camera) { Camera.Parameters parameters = camera.getParameters(); WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = manager.getDefaultDisplay(); int width = display.getWidth(); int height = display.getHeight(); // We're landscape-only, and have apparently seen issues with display // thinking it's portrait // when waking from sleep. If it's not landscape, assume it's mistaken // and reverse them: if (width < height) { Log.i(TAG, "Display reports portrait orientation; assuming this is incorrect"); int temp = width; width = height; height = temp; } screenResolution = new Point(width, height); Log.i(TAG, "Screen resolution: " + screenResolution); cameraResolution = findBestPreviewSizeValue(parameters, screenResolution, false); Log.i(TAG, "Camera resolution: " + cameraResolution); }
Example 2
Source File: CameraPreview.java From cordova-plugin-camera-preview with MIT License | 6 votes |
private boolean getSupportedWhiteBalanceModes(CallbackContext callbackContext) { if(this.hasCamera(callbackContext) == false){ return true; } Camera camera = fragment.getCamera(); Camera.Parameters params = camera.getParameters(); List<String> supportedWhiteBalanceModes; supportedWhiteBalanceModes = params.getSupportedWhiteBalance(); JSONArray jsonWhiteBalanceModes = new JSONArray(); if (camera.getParameters().isAutoWhiteBalanceLockSupported()) { jsonWhiteBalanceModes.put(new String("lock")); } if (supportedWhiteBalanceModes != null) { for (int i=0; i<supportedWhiteBalanceModes.size(); i++) { jsonWhiteBalanceModes.put(new String(supportedWhiteBalanceModes.get(i))); } } callbackContext.success(jsonWhiteBalanceModes); return true; }
Example 3
Source File: CameraCharacteristicsMaxApiLevel20.java From fdroidclient with GNU General Public License v3.0 | 6 votes |
private boolean hasDeviceAutofocusCapability() throws FDroidDeviceException { try { final int numberOfCameras = Camera.getNumberOfCameras(); if (numberOfCameras == 0) { Log.i(TAG, "No camera on device"); return false; } boolean hasAutofocus = false; for (int cameraId = 0; cameraId < numberOfCameras; cameraId++) { Camera camera = Camera.open(cameraId); Camera.Parameters parameters = camera.getParameters(); List<String> availableAFModes = parameters.getSupportedFocusModes(); hasAutofocus = availableAFModes.contains(Camera.Parameters.FOCUS_MODE_AUTO); } return hasAutofocus; } catch (Exception e) { String msg = "Exception accessing device camera"; Log.e(TAG, msg, e); throw new FDroidDeviceException(msg, e); } }
Example 4
Source File: CameraPreview.java From cordova-plugin-camera-preview with MIT License | 6 votes |
private boolean setZoom(int zoom, CallbackContext callbackContext) { if(this.hasCamera(callbackContext) == false){ return true; } Camera camera = fragment.getCamera(); Camera.Parameters params = camera.getParameters(); if (camera.getParameters().isZoomSupported()) { params.setZoom(zoom); fragment.setCameraParameters(params); callbackContext.success(zoom); } else { callbackContext.error("Zoom not supported"); } return true; }
Example 5
Source File: CameraConfigurationManager.java From Gizwits-SmartBuld_Android with MIT License | 5 votes |
public void setDesiredCameraParameters(Camera camera, boolean safeMode) { Camera.Parameters parameters = camera.getParameters(); if (parameters == null) { Log.w(TAG, "Device error: no camera parameters are available. Proceeding without configuration."); return; } Log.i(TAG, "Initial camera parameters: " + parameters.flatten()); if (safeMode) { Log.w(TAG, "In camera config safe mode -- most settings will not be honored"); } parameters.setPreviewSize(cameraResolution.x, cameraResolution.y); camera.setParameters(parameters); Camera.Parameters afterParameters = camera.getParameters(); Camera.Size afterSize = afterParameters.getPreviewSize(); if (afterSize != null && (cameraResolution.x != afterSize.width || cameraResolution.y != afterSize.height)) { Log.w(TAG, "Camera said it supported preview size " + cameraResolution.x + 'x' + cameraResolution.y + ", but after setting it, preview size is " + afterSize.width + 'x' + afterSize.height); cameraResolution.x = afterSize.width; cameraResolution.y = afterSize.height; } /** 设置相机预览为竖屏 */ String model=android.os.Build.MODEL; if("Nexus 5X".equals(model)){ camera.setDisplayOrientation(270); }else{ camera.setDisplayOrientation(90); } }
Example 6
Source File: CameraPreview.java From cordova-plugin-camera-preview with MIT License | 5 votes |
private boolean setExposureCompensation(int exposureCompensation, CallbackContext callbackContext) { if(this.hasCamera(callbackContext) == false){ return true; } Camera camera = fragment.getCamera(); Camera.Parameters params = camera.getParameters(); int minExposureCompensation = camera.getParameters().getMinExposureCompensation(); int maxExposureCompensation = camera.getParameters().getMaxExposureCompensation(); if ( minExposureCompensation == 0 && maxExposureCompensation == 0) { callbackContext.error("Exposure corection not supported"); } else { if (exposureCompensation < minExposureCompensation) { exposureCompensation = minExposureCompensation; } else if (exposureCompensation > maxExposureCompensation) { exposureCompensation = maxExposureCompensation; } params.setExposureCompensation(exposureCompensation); fragment.setCameraParameters(params); callbackContext.success(exposureCompensation); } return true; }
Example 7
Source File: CameraConfigurationManager.java From android-mrz-reader with Apache License 2.0 | 5 votes |
void setDesiredCameraParameters(Camera camera) { Camera.Parameters parameters = camera.getParameters(); if (parameters == null) { Log.w(TAG, "Device error: no camera parameters are available. Proceeding without configuration."); return; } SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); initializeTorch(parameters, prefs); String focusMode = null; if (prefs.getBoolean(PreferencesActivity.KEY_AUTO_FOCUS, true)) { if (prefs.getBoolean(PreferencesActivity.KEY_DISABLE_CONTINUOUS_FOCUS, false)) { focusMode = findSettableValue(parameters.getSupportedFocusModes(), Camera.Parameters.FOCUS_MODE_AUTO); } else { focusMode = findSettableValue(parameters.getSupportedFocusModes(), "continuous-video", // Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO in 4.0+ "continuous-picture", // Camera.Paramters.FOCUS_MODE_CONTINUOUS_PICTURE in 4.0+ Camera.Parameters.FOCUS_MODE_AUTO); } } // Maybe selected auto-focus but not available, so fall through here: if (focusMode == null) { focusMode = findSettableValue(parameters.getSupportedFocusModes(), Camera.Parameters.FOCUS_MODE_MACRO, "edof"); // Camera.Parameters.FOCUS_MODE_EDOF in 2.2+ } if (focusMode != null) { parameters.setFocusMode(focusMode); } parameters.setPreviewSize(cameraResolution.x, cameraResolution.y); camera.setParameters(parameters); }
Example 8
Source File: SquareCameraPreview.java From pause-resume-video-recording with Apache License 2.0 | 5 votes |
public void setCamera(Camera camera) { mCamera = camera; if (camera != null) { Camera.Parameters params = camera.getParameters(); mIsZoomSupported = params.isZoomSupported(); if (mIsZoomSupported) { mMaxZoom = params.getMaxZoom(); } } }
Example 9
Source File: AutoFocusManager.java From qrcode_android with GNU Lesser General Public License v3.0 | 5 votes |
public static boolean setCameraContinuousFocus(Camera camera) { if (camera == null) return false; Camera.Parameters parameters = camera.getParameters(); if (parameters == null) return false; List<String> focusModes = parameters.getSupportedFocusModes(); if (focusModes.contains("continuous-video")) { parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO); camera.setParameters(parameters); Log.v(TAG, "use continuous video mode"); return true; } return false; }
Example 10
Source File: CameraConfigurationManager.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
/** * Sets the camera up to take preview images which are used for both preview and decoding. * We detect the preview format here so that buildLuminanceSource() can build an appropriate * LuminanceSource subclass. In the future we may want to force YUV420SP as it's the smallest, * and the planar Y can be used for barcode scanning without a copy in some cases. */ void setDesiredCameraParameters(Camera camera) { Camera.Parameters parameters = camera.getParameters(); Log.d(TAG, "Setting preview size: " + cameraResolution); parameters.setPreviewSize(cameraResolution.x, cameraResolution.y); setFlash(parameters); setZoom(parameters); //setSharpness(parameters); //modify here camera.setDisplayOrientation(90); camera.setParameters(parameters); }
Example 11
Source File: CameraManager.java From appinventor-extensions with Apache License 2.0 | 4 votes |
/** * Opens the camera driver and initializes the hardware parameters. * * @param holder The surface object which the camera will draw preview frames into. * @throws IOException Indicates the camera driver failed to open. */ public synchronized void openDriver(SurfaceHolder holder) throws IOException { Camera theCamera = camera; if (theCamera == null) { theCamera = new OpenCameraManager().build().open(); if (theCamera == null) { throw new IOException(); } camera = theCamera; } theCamera.setPreviewDisplay(holder); if (!initialized) { initialized = true; configManager.initFromCameraParameters(theCamera); if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) { setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight); requestedFramingRectWidth = 0; requestedFramingRectHeight = 0; } } Camera.Parameters parameters = theCamera.getParameters(); String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily try { configManager.setDesiredCameraParameters(theCamera, false); } catch (RuntimeException re) { // Driver failed Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters"); Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened); // Reset: if (parametersFlattened != null) { parameters = theCamera.getParameters(); parameters.unflatten(parametersFlattened); try { theCamera.setParameters(parameters); configManager.setDesiredCameraParameters(theCamera, true); } catch (RuntimeException re2) { // Well, darn. Give up Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration"); } } } }
Example 12
Source File: CameraSource.java From Barcode-Reader with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * Opens the camera and applies the user settings. * * @throws RuntimeException if the method fails */ @SuppressLint("InlinedApi") private Camera createCamera() { int requestedCameraId = getIdForRequestedCamera(mFacing); if (requestedCameraId == -1) { throw new RuntimeException("Could not find requested camera."); } Camera camera = Camera.open(requestedCameraId); SizePair sizePair = selectSizePair(camera, mRequestedPreviewWidth, mRequestedPreviewHeight); if (sizePair == null) { throw new RuntimeException("Could not find suitable preview size."); } Size pictureSize = sizePair.pictureSize(); mPreviewSize = sizePair.previewSize(); int[] previewFpsRange = selectPreviewFpsRange(camera, mRequestedFps); if (previewFpsRange == null) { throw new RuntimeException("Could not find suitable preview frames per second range."); } Camera.Parameters parameters = camera.getParameters(); if (pictureSize != null) { parameters.setPictureSize(pictureSize.getWidth(), pictureSize.getHeight()); } parameters.setPreviewSize(mPreviewSize.getWidth(), mPreviewSize.getHeight()); parameters.setPreviewFpsRange( previewFpsRange[Camera.Parameters.PREVIEW_FPS_MIN_INDEX], previewFpsRange[Camera.Parameters.PREVIEW_FPS_MAX_INDEX]); parameters.setPreviewFormat(ImageFormat.NV21); setRotation(camera, parameters, requestedCameraId); if (mFocusMode != null) { if (parameters.getSupportedFocusModes().contains( mFocusMode)) { parameters.setFocusMode(mFocusMode); } else { Log.i(TAG, "Camera focus mode: " + mFocusMode + " is not supported on this device."); } } // setting mFocusMode to the one set in the params mFocusMode = parameters.getFocusMode(); if (mFlashMode != null) { if (parameters.getSupportedFlashModes() != null) { if (parameters.getSupportedFlashModes().contains( mFlashMode)) { parameters.setFlashMode(mFlashMode); } else { Log.i(TAG, "Camera flash mode: " + mFlashMode + " is not supported on this device."); } } } // setting mFlashMode to the one set in the params mFlashMode = parameters.getFlashMode(); camera.setParameters(parameters); // Four frame buffers are needed for working with the camera: // // one for the frame that is currently being executed upon in doing detection // one for the next pending frame to process immediately upon completing detection // two for the frames that the camera uses to populate future preview images camera.setPreviewCallbackWithBuffer(new CameraPreviewCallback()); camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize)); camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize)); camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize)); camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize)); return camera; }
Example 13
Source File: CameraConfigurationManager.java From moVirt with Apache License 2.0 | 4 votes |
void setTorch(Camera camera, boolean newSetting) { Camera.Parameters parameters = camera.getParameters(); doSetTorch(parameters, newSetting, false); camera.setParameters(parameters); }
Example 14
Source File: CameraManager.java From ZXingProject with MIT License | 4 votes |
/** * Opens the camera driver and initializes the hardware parameters. * * @param holder * The surface object which the camera will draw preview frames * into. * @throws IOException * Indicates the camera driver failed to open. */ public synchronized void openDriver(SurfaceHolder holder) throws IOException { Camera theCamera = camera; if (theCamera == null) { if (requestedCameraId >= 0) { theCamera = OpenCameraInterface.open(requestedCameraId); } else { theCamera = OpenCameraInterface.open(); } if (theCamera == null) { throw new IOException(); } camera = theCamera; } theCamera.setPreviewDisplay(holder); if (!initialized) { initialized = true; configManager.initFromCameraParameters(theCamera); } Camera.Parameters parameters = theCamera.getParameters(); String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save // these, // temporarily try { configManager.setDesiredCameraParameters(theCamera, false); } catch (RuntimeException re) { // Driver failed Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters"); Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened); // Reset: if (parametersFlattened != null) { parameters = theCamera.getParameters(); parameters.unflatten(parametersFlattened); try { theCamera.setParameters(parameters); configManager.setDesiredCameraParameters(theCamera, true); } catch (RuntimeException re2) { // Well, darn. Give up Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration"); } } } }
Example 15
Source File: CameraConfigurationManager.java From barcodescanner-lib-aar with MIT License | 4 votes |
void setTorch(Camera camera, boolean newSetting) { Camera.Parameters parameters = camera.getParameters(); doSetTorch(parameters, newSetting, false); camera.setParameters(parameters); }
Example 16
Source File: CameraSource.java From Questor with MIT License | 4 votes |
/** * Opens the camera and applies the user settings. * * @throws RuntimeException if the method fails */ @SuppressLint("InlinedApi") private Camera createCamera() { int requestedCameraId = getIdForRequestedCamera(mFacing); if (requestedCameraId == -1) { throw new RuntimeException("Could not find requested camera."); } Camera camera = Camera.open(requestedCameraId); SizePair sizePair = selectSizePair(camera, mRequestedPreviewWidth, mRequestedPreviewHeight); if (sizePair == null) { throw new RuntimeException("Could not find suitable preview size."); } Size pictureSize = sizePair.pictureSize(); mPreviewSize = sizePair.previewSize(); int[] previewFpsRange = selectPreviewFpsRange(camera, mRequestedFps); if (previewFpsRange == null) { throw new RuntimeException("Could not find suitable preview frames per second range."); } Camera.Parameters parameters = camera.getParameters(); if (pictureSize != null) { parameters.setPictureSize(pictureSize.getWidth(), pictureSize.getHeight()); } parameters.setPreviewSize(mPreviewSize.getWidth(), mPreviewSize.getHeight()); parameters.setPreviewFpsRange( previewFpsRange[Camera.Parameters.PREVIEW_FPS_MIN_INDEX], previewFpsRange[Camera.Parameters.PREVIEW_FPS_MAX_INDEX]); parameters.setPreviewFormat(ImageFormat.NV21); setRotation(camera, parameters, requestedCameraId); if (mFocusMode != null) { if (parameters.getSupportedFocusModes().contains( mFocusMode)) { parameters.setFocusMode(mFocusMode); } else { Log.i(TAG, "Camera focus mode: " + mFocusMode + " is not supported on this device."); } } // setting mFocusMode to the one set in the params mFocusMode = parameters.getFocusMode(); if (mFlashMode != null) { if (parameters.getSupportedFlashModes().contains( mFlashMode)) { parameters.setFlashMode(mFlashMode); } else { Log.i(TAG, "Camera flash mode: " + mFlashMode + " is not supported on this device."); } } // setting mFlashMode to the one set in the params mFlashMode = parameters.getFlashMode(); camera.setParameters(parameters); // Four frame buffers are needed for working with the camera: // // one for the frame that is currently being executed upon in doing detection // one for the next pending frame to process immediately upon completing detection // two for the frames that the camera uses to populate future preview images camera.setPreviewCallbackWithBuffer(new CameraPreviewCallback()); camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize)); camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize)); camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize)); camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize)); return camera; }
Example 17
Source File: CameraManager.java From myapplication with Apache License 2.0 | 4 votes |
/** * Opens the camera driver and initializes the hardware parameters. * * @param holder The surface object which the camera will draw preview frames * into. * @throws IOException Indicates the camera driver failed to open. */ public synchronized void openDriver(SurfaceHolder holder) throws IOException { Camera theCamera = camera; if (theCamera == null) { if (requestedCameraId >= 0) { theCamera = OpenCameraInterface.open(requestedCameraId); } else { theCamera = OpenCameraInterface.open(); } if (theCamera == null) { throw new IOException(); } camera = theCamera; } theCamera.setPreviewDisplay(holder); if (!initialized) { initialized = true; configManager.initFromCameraParameters(theCamera); } Camera.Parameters parameters = theCamera.getParameters(); String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save // these, // temporarily try { configManager.setDesiredCameraParameters(theCamera, false); } catch (RuntimeException re) { // Driver failed Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters"); Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened); // Reset: if (parametersFlattened != null) { parameters = theCamera.getParameters(); parameters.unflatten(parametersFlattened); try { theCamera.setParameters(parameters); configManager.setDesiredCameraParameters(theCamera, true); } catch (RuntimeException re2) { // Well, darn. Give up Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration"); } } } }
Example 18
Source File: CameraManager.java From gokit-android with MIT License | 4 votes |
/** * Opens the camera driver and initializes the hardware parameters. * * @param holder * The surface object which the camera will draw preview frames * into. * @throws IOException * Indicates the camera driver failed to open. */ public synchronized void openDriver(SurfaceHolder holder) throws IOException { Camera theCamera = camera; if (theCamera == null) { if (requestedCameraId >= 0) { theCamera = OpenCameraInterface.open(requestedCameraId); } else { theCamera = OpenCameraInterface.open(); } if (theCamera == null) { throw new IOException(); } camera = theCamera; } theCamera.setPreviewDisplay(holder); if (!initialized) { initialized = true; configManager.initFromCameraParameters(theCamera); } Camera.Parameters parameters = theCamera.getParameters(); String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save // these, // temporarily try { configManager.setDesiredCameraParameters(theCamera, false); } catch (RuntimeException re) { // Driver failed Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters"); Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened); // Reset: if (parametersFlattened != null) { parameters = theCamera.getParameters(); parameters.unflatten(parametersFlattened); try { theCamera.setParameters(parameters); configManager.setDesiredCameraParameters(theCamera, true); } catch (RuntimeException re2) { // Well, darn. Give up Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration"); } } } }
Example 19
Source File: CameraManager.java From reacteu-app with MIT License | 4 votes |
/** * Opens the camera driver and initializes the hardware parameters. * * @param holder The surface object which the camera will draw preview frames into. * @throws IOException Indicates the camera driver failed to open. */ public synchronized void openDriver(SurfaceHolder holder) throws IOException { Camera theCamera = camera; if (theCamera == null) { theCamera = new OpenCameraManager().build().open(); if (theCamera == null) { throw new IOException(); } camera = theCamera; } theCamera.setPreviewDisplay(holder); if (!initialized) { initialized = true; configManager.initFromCameraParameters(theCamera); if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) { setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight); requestedFramingRectWidth = 0; requestedFramingRectHeight = 0; } } Camera.Parameters parameters = theCamera.getParameters(); String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily try { configManager.setDesiredCameraParameters(theCamera, false); } catch (RuntimeException re) { // Driver failed Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters"); Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened); // Reset: if (parametersFlattened != null) { parameters = theCamera.getParameters(); parameters.unflatten(parametersFlattened); try { theCamera.setParameters(parameters); configManager.setDesiredCameraParameters(theCamera, true); } catch (RuntimeException re2) { // Well, darn. Give up Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration"); } } } }
Example 20
Source File: CameraManager.java From CodeScaner with MIT License | 4 votes |
/** * Opens the camera driver and initializes the hardware parameters. * * @param holder The surface object which the camera will draw preview frames into. * * @throws IOException Indicates the camera driver failed to open. */ public synchronized void openDriver(SurfaceHolder holder) throws IOException { OpenCamera theCamera = camera; if (theCamera == null) { theCamera = OpenCameraInterface.open(requestedCameraId); if (theCamera == null) { throw new IOException("Camera.open() failed to return object from driver"); } camera = theCamera; } if (!initialized) { initialized = true; configManager.initFromCameraParameters(theCamera); if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) { setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight); requestedFramingRectWidth = 0; requestedFramingRectHeight = 0; } } Camera cameraObject = theCamera.getCamera(); Camera.Parameters parameters = cameraObject.getParameters(); String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save // these, temporarily try { configManager.setDesiredCameraParameters(theCamera, false); } catch (RuntimeException re) { // Driver failed if (DEBUG) { Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters"); Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened); } // Reset: if (parametersFlattened != null) { parameters = cameraObject.getParameters(); parameters.unflatten(parametersFlattened); try { cameraObject.setParameters(parameters); configManager.setDesiredCameraParameters(theCamera, true); } catch (RuntimeException re2) { // Well, darn. Give up Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration"); } } } cameraObject.setPreviewDisplay(holder); }