Android Camera.Parameters - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Camera.Parameters class.

This code example shows how to use the following methods:getFlashMode, getSupportedFlashModes, setFlashMode
Parameters parameters = mCamera.getParameters();
            if (parameters == null) {
                return; 
            } 
            List<String> flashModes = parameters.getSupportedFlashModes();
            String flashMode = parameters.getFlashMode();
            // Check if camera flash exists 
            if (flashModes == null) {
                return; 
            } 
            Log.i(TAG, "Flash mode: " + flashMode);
            Log.i(TAG, "Flash modes: " + flashModes);
            if (!Parameters.FLASH_MODE_OFF.equals(flashMode)) {
                // Turn off the flash 
                if (flashModes.contains(Parameters.FLASH_MODE_OFF)) {
                    parameters.setFlashMode(Parameters.FLASH_MODE_OFF);
                    mCamera.setParameters(parameters);
                    stopWakeLock(); 
                } else { 

8
CodeRank
This code example shows how to use the following methods:setPictureSize, setPreviewSize
    public final void surfaceCreated(final SurfaceHolder holder) {
    	if (D) Log.d(TAG, "surfaceCreated");   	
    	_controller.setPreviewDisplay(holder);
    	Parameters params = _controller.getCameraParams();
    	if (params != null) {
	    	if (_previewSize != null) params.setPreviewSize(_previewSize.width, _previewSize.height);
	    	if (_pictureSize != null) params.setPictureSize(_pictureSize.width, _pictureSize.height);
	    	_controller.setCameraParams(params);
    	} 
    	this.setWillNotDraw(false);
    } 
 
    // Surface will be destroyed when we return, so stop the preview 
    public final void surfaceDestroyed(final SurfaceHolder holder) {
    	if (D) Log.d(TAG, "surfaceDestroyed");
    	this.setWillNotDraw(true);
    	_controller.stopPreview(); //Need a safe way to stop the preview when the activity isn't killed
    	_controller.stopCamera();
    	 
    } 
6
CodeRank
This code example shows how to use the following methods:getFlashMode, getSupportedFlashModes, setFlashMode
      Parameters parameters = mCamera.getParameters();
      if (parameters == null) {
    	  Log.d(TAG, "Y U NO HAVE CAMERA PARAMS!");
        return; 
      } 
      List<String> flashModes = parameters.getSupportedFlashModes();
      String flashMode = parameters.getFlashMode();
      // Check if camera flash exists 
      if (flashModes == null) {
    	  Log.d(TAG, "Y U NO HAVE FLASH!");
        return; 
      } 
      Log.i(TAG, "Flash mode: " + flashMode);
      Log.i(TAG, "Flash modes: " + flashModes);
      if (!Parameters.FLASH_MODE_OFF.equals(flashMode)) {
        // Turn off the flash 
        if (flashModes.contains(Parameters.FLASH_MODE_OFF)) {
          parameters.setFlashMode(Parameters.FLASH_MODE_OFF);
          mCamera.setParameters(parameters);
          stopWakeLock(); 

6
CodeRank
This code example shows how to use the following methods:getFocusMode, getSupportedFocusModes, setFocusMode
		if(!this.mPreviewing) this.startPreview();
	} 
	 
	public void setAutoFocusEnabled(boolean enabled){
		String focusmode = enabled ? ENABLEDAUTOFOCUSSETTING : DISABLEDAUTOFOCUSSETTING;
		if(this.mParameters.getFocusMode() != focusmode && this.isSupported(focusmode, this.mParameters.getSupportedFocusModes())){
			this.mParameters.setFocusMode(focusmode);
			this.mCameraDevice.setParameters(this.mParameters);
		} 
	} 
	 
	public void setColorEffect(String colorEffect){
		if(this.mCameraDevice != null && this.isSupported(colorEffect, this.mParameters.getSupportedColorEffects())){
			this.mParameters.setColorEffect(colorEffect);
			this.mCameraDevice.setParameters(this.mParameters);
		} 
	} 
	 
	public List<String> getSupportedEffects(){
		if(this.mParameters != null)
6
CodeRank
This code example shows how to use the following methods:getFlashMode, getFocusMode, getHorizontalViewAngle, setFlashMode, setFocusMode
This code example shows how to use the following methods:setGpsAltitude, setGpsLatitude, setGpsLongitude, setGpsTimestamp
This code example shows how to use the following methods:setColorEffect, setFocusMode, setPreviewFrameRate, setPreviewSize, setSceneMode
This code example shows how to use the following methods:setFlashMode, setFocusMode, setJpegQuality, setPreviewFrameRate, setPreviewSize
   */ 
  private void setupCamera() { 
    Log.d(LOG_TAG, "Setting up camera"); 
    camera = Camera.open(); 
    parameters = camera.getParameters(); 
    parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO); 
    parameters.setFlashMode(Camera.Parameters.FLASH_MODE_ON); 
    parameters.setJpegQuality(JPEG_QUALITY); 
    parameters.setRotation(270); 
    parameters.setPreviewFrameRate(PREVIEW_FRAMERATE); 
    parameters.setPreviewSize(PREVIEW_WIDTH, PREVIEW_HEIGHT); 
    camera.setParameters(parameters); 
    try { 
      camera.setPreviewDisplay(dummySurface.getHolder()); 
      camera.setPreviewCallback(new Camera.PreviewCallback() { 
        public void onPreviewFrame(byte[] frameData, Camera camera) { 
          try { 
            int pw = PREVIEW_WIDTH; 
            int ph = PREVIEW_HEIGHT; 
            // setting the preview image format to jpeg causes an error. 
6
CodeRank
This code example shows how to use the following methods:getSupportedFlashModes, getSupportedFocusModes, setFlashMode, setFocusMode, setPreviewSize
6
CodeRank
This code example shows how to use the following methods:getSupportedFlashModes, getSupportedFocusModes, setFlashMode, setFocusMode, setPreviewSize
6
CodeRank

Related Android Camera.Parameters Questions & Answers:

Other Android Camera.Parameters Examples

20:		private boolean isFlashOn;
21:		private boolean hasFlash;
22:		Parameters params;
23:		MediaPlayer mp;
24:

Read More

20:		private boolean isFlashOn;
21:		private boolean hasFlash;
22:		Parameters params;
23:		MediaPlayer mp;
24:

Read More

See Code Examples for Android Camera.Parameters Methods: