Camera getParameters - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Camera getParameters method.

This code example shows how to use the following methods:getParameters
		} 
		return new Size(neww, newh);
	} 
	 
	public boolean isAutoFocusSupported(android.hardware.Camera camera) {
		String focus_mode = camera.getParameters().getFocusMode();
		boolean auto_focus_supported = false;
		if ( focus_mode != null ) {
			auto_focus_supported = (focus_mode.equals(android.hardware.Camera.Parameters.FOCUS_MODE_AUTO)) || (focus_mode.equals(android.hardware.Camera.Parameters.FOCUS_MODE_MACRO));
		} 
		return auto_focus_supported;
	} 
	 
	public boolean isFlashModeSupported(android.hardware.Camera camera, String flash_mode) {
		String camera_flash_mode = camera.getParameters().getFlashMode();
		boolean flash_supported = false;
		if ( camera_flash_mode != null ) {
			List<String> modes_list = camera.getParameters().getSupportedFlashModes();
			if (modes_list != null) {
				if (modes_list.contains(flash_mode)) {
10
CodeRank
This code example shows how to use the following methods:getParameters
		com.rhomobile.rhodes.camera.Camera.logDebug(TAG, "getClosestPreviewSize() return ["+String.valueOf(neww)+", "+String.valueOf(newh)+"]");
		return new Size(neww, newh);
	} 
	 
	public boolean isAutoFocusSupported(android.hardware.Camera camera) {
		String focus_mode = camera.getParameters().getFocusMode();
		boolean auto_focus_supported = false;
		if  ( focus_mode != null ) {
			auto_focus_supported = (focus_mode.equals(android.hardware.Camera.Parameters.FOCUS_MODE_AUTO)) || (focus_mode.equals(android.hardware.Camera.Parameters.FOCUS_MODE_MACRO));
		} 
		return auto_focus_supported;
	} 
	 
	public boolean isFlashModeSupported(android.hardware.Camera camera, String flash_mode) {
		String camera_flash_mode = camera.getParameters().getFlashMode();
		if (flash_mode != null) { 
			//Utils.platformLog("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$  FLASH_MODE", camera_flash_mode); 
		} 
		else { 
			//Utils.platformLog("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$  FLASH_MODE", "NULL"); 
10
CodeRank
This code example shows how to use the following methods:getParameters, setParameters
                            @Override 
                            public void onClick(DialogInterface dialog, int witch) {
                                // 選択されたインデックスを覚えておく 
                                mCurrentFlashModeIndex = witch;
                                // カメラパラメータを取得して 
                                Parameters params = mCamera.getParameters();
                                // フラッシュモードを取得して 
                                String flashMode = mSupportedFlashModes[witch];
                                // カメラパラメータにフラッシュモードをセット 
                                params.setFlashMode(flashMode);
                                // カメラパラメータをカメラにセット 
                                mCamera.setParameters(params);
                                // 勝手に閉じないので閉じる 
                                dialog.dismiss();
                            } 
                        }).show();
    } 
 
    private void showToast(String text) {
        Toast.makeText(this, text, Toast.LENGTH_SHORT).show();
10
CodeRank
This code example shows how to use the following methods:getParameters, setParameters, setPreviewDisplay, startPreview
 
} 
 
 
private void startCamera(SurfaceHolder sh, int width, int height) {
    Camera.Parameters p = mCam.getParameters();
    // Camera.Size s = p.getSupportedPreviewSizes().get(0); 
    p.setPreviewSize(width, height);
 
    mCam.setParameters(p);
 
    try { 
        mCam.setPreviewDisplay(sh);
    } catch (Exception e) {
    } 
 
    mCam.startPreview();
} 
 
private void stopCamera() { 

10
CodeRank
This code example shows how to use the following methods:getParameters, setParameters, setPreviewDisplay
      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 { 

10
CodeRank
This code example shows how to use the following methods:getParameters, stopPreview
    { 
        Log.e(TAG, "surfaceChanged");
 
        // XXX stopPreview() will crash if preview is not running 
        if (mPreviewRunning) {
            mCamera.stopPreview();
        } 
 
        Camera.Parameters p = mCamera.getParameters();
        p.setPreviewSize(w, h);
        mCamera.setParameters(p);
        try { 
			mCamera.setPreviewDisplay(holder);
		} catch (IOException e) {
			// TODO Auto-generated catch block 
			e.printStackTrace();
		} 
        mCamera.startPreview();
        mPreviewRunning = true;
    } 
10
CodeRank
This code example shows how to use the following methods:getParameters, setParameters, setPreviewDisplay, startPreview
		if(!isView){//ÊÇ·ñÒѾ­ÏÔʾ
    		myCamera = Camera.open();
    	} 
		if(myCamera != null && !isView){
            try { 
            	Camera.Parameters myParameters = myCamera.getParameters();
            	myParameters.setPictureFormat(PixelFormat.JPEG);
            	myParameters.setPreviewSize(320, 445);//ÆÁÄ»´óС
            	myCamera.setParameters(myParameters);
    			myCamera.setPreviewDisplay(mySurfaceHolder);
    			myCamera.startPreview();//Á¢¼´ÔËÐÐPreview
    		}  
            catch (IOException e) {//²¶»ñÒì³£
    			e.printStackTrace();//´òÓ¡´íÎóÐÅÏ¢
    		}   
            isView = true;//½«ÊÇ·ñÏÔʾ±ê־λÉèÖóÉtrue
    	} 
	} 
	@Override 
	public void surfaceChanged(SurfaceHolder holder, int format, int width,int height) {}
10
CodeRank
This code example shows how to use the following methods:getParameters, setParameters
      lightOn = false;
      if (mCamera == null) {
    	  Log.d(TAG, "Y U NO HAVE CAMERA!");
        return; 
      } 
      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)) {

10
CodeRank
This code example shows how to use the following methods:getParameters
	} 
	 
	public void setCamera(Camera camera) {
		mCamera = camera;
		if (mCamera != null) {
			mSupportedPreviewSizes = mCamera.getParameters()
			    .getSupportedPreviewSizes();
			requestLayout();
		} 
	} 
 
	public void switchCamera(Camera camera) {
		setCamera(camera);
		try { 
			if (true) 
				camera.setPreviewDisplay(mHolder);
		} catch (IOException exception) {
			Log.e(TAG, "IOException caused by setPreviewDisplay()", exception);
		} 
		Camera.Parameters parameters = camera.getParameters();
10
CodeRank
This code example shows how to use the following methods:getParameters, stopPreview
	public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
		Log.e(TAG, "surfaceChanged");
 
		// XXX stopPreview() will crash if preview is not running 
		if (previewRunning) {
			camara.stopPreview();
		} 
 
		Camera.Parameters p = camara.getParameters();
		p.setPreviewSize(w, h);
		camara.setParameters(p);
		try { 
			camara.setPreviewDisplay(holder);
		} catch (IOException e) {
			// TODO Auto-generated catch block 
			e.printStackTrace();
		} 
		camara.startPreview();
		previewRunning = true;
	} 
9
CodeRank

Related Camera getParameters Questions & Answers:

Other Camera getParameters Examples

82:				try {
83:					camera = Camera.open();
84:					params = camera.getParameters();
85:				} catch (RuntimeException e) {
86:					Log.e("Camera Error. Failed to Open. Error: ", e.getMessage());
-
99:				playSound();
100:				
101:				params = camera.getParameters();
102:				params.setFlashMode(Parameters.FLASH_MODE_TORCH);
103:				camera.setParameters(params);
-
121:				playSound();
122:				
123:				params = camera.getParameters();
124:				params.setFlashMode(Parameters.FLASH_MODE_OFF);
125:				camera.setParameters(params);

Read More

getParameters Method Overview
Returns the current settings for this Camera service.
See Code Examples for other Android Camera Methods: