當前位置: 首頁>>代碼示例>>Java>>正文


Java Camera.setPreviewDisplay方法代碼示例

本文整理匯總了Java中android.hardware.Camera.setPreviewDisplay方法的典型用法代碼示例。如果您正苦於以下問題:Java Camera.setPreviewDisplay方法的具體用法?Java Camera.setPreviewDisplay怎麽用?Java Camera.setPreviewDisplay使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.hardware.Camera的用法示例。


在下文中一共展示了Camera.setPreviewDisplay方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startPreviewInternal

import android.hardware.Camera; //導入方法依賴的package包/類
private void startPreviewInternal(boolean internal) {
    try {
        DecoderWrapper decoderWrapper = mDecoderWrapper;
        Camera camera = decoderWrapper.getCamera();
        camera.setPreviewCallback(mPreviewCallback);
        camera.setPreviewDisplay(mSurfaceHolder);
        if (!internal && decoderWrapper.isFlashSupported() && mFlashEnabled) {
            setFlashEnabledInternal(true);
        }
        camera.startPreview();
        mStoppingPreview = false;
        mPreviewActive = true;
        mSafeAutoFocusing = false;
        mSafeAutoFocusAttemptsCount = 0;
        if (mAutoFocusMode == AutoFocusMode.SAFE) {
            scheduleSafeAutoFocusTask();
        }
    } catch (Exception ignored) {
    }
}
 
開發者ID:yuriy-budiyev,項目名稱:code-scanner,代碼行數:21,代碼來源:CodeScanner.java

示例2: switchCamera

import android.hardware.Camera; //導入方法依賴的package包/類
public void switchCamera(Camera camera, int cameraId) {
  try {
    setCamera(camera, cameraId);

    Log.d("CameraPreview", "before set camera");

    camera.setPreviewDisplay(mHolder);

    Log.d("CameraPreview", "before getParameters");

    Camera.Parameters parameters = camera.getParameters();

    Log.d("CameraPreview", "before setPreviewSize");

    mSupportedPreviewSizes = parameters.getSupportedPreviewSizes();
    mPreviewSize = getOptimalPreviewSize(mSupportedPreviewSizes, mSurfaceView.getWidth(), mSurfaceView.getHeight());
    parameters.setPreviewSize(mPreviewSize.width, mPreviewSize.height);
    Log.d(TAG, mPreviewSize.width + " " + mPreviewSize.height);

    camera.setParameters(parameters);
  } catch (IOException exception) {
    Log.e(TAG, exception.getMessage());
  }
}
 
開發者ID:MrShakes,項目名稱:cameraPreviewStream,代碼行數:25,代碼來源:Preview.java

示例3: setPreview

import android.hardware.Camera; //導入方法依賴的package包/類
public void setPreview(Camera camera) throws IOException {
    if(surfaceHolder != null) {
        camera.setPreviewDisplay(surfaceHolder);
    } else {
        if(Build.VERSION.SDK_INT >= 11) {
            camera.setPreviewTexture(surfaceTexture);
        } else {
            // This should not happen, but we check for it anyway.
            throw new IllegalStateException("SurfaceTexture not supported.");
        }
    }
}
 
開發者ID:yinhaojun,項目名稱:ZxingForAndroid,代碼行數:13,代碼來源:CameraSurface.java

示例4: switchCamera

import android.hardware.Camera; //導入方法依賴的package包/類
public void switchCamera(Camera camera) {
    setCamera(camera);
    try {
        camera.setPreviewDisplay(mHolder);
    } catch (IOException exception) {
        Log.e(TAG, "IOException caused by setPreviewDisplay()", exception);
    }
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:9,代碼來源:CameraFragment.java

示例5: openDriver

import android.hardware.Camera; //導入方法依賴的package包/類
/**
 * 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");
			}
		}
	}

}
 
開發者ID:TonnyL,項目名稱:Espresso,代碼行數:57,代碼來源:CameraManager.java

示例6: openDriver

import android.hardware.Camera; //導入方法依賴的package包/類
/**
 * 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 = OpenCameraInterface.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");
      }
    }
  }

}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:51,代碼來源:CameraManager.java

示例7: openDriver

import android.hardware.Camera; //導入方法依賴的package包/類
/**
 * 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
        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);

}
 
開發者ID:Zmingxu,項目名稱:ZxingScanner,代碼行數:52,代碼來源:CameraManager.java

示例8: openDriver

import android.hardware.Camera; //導入方法依賴的package包/類
/**
 * 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");
            }
        }
    }

}
 
開發者ID:alibaba,項目名稱:LuaViewPlayground,代碼行數:55,代碼來源:CameraManager.java

示例9: openDriver

import android.hardware.Camera; //導入方法依賴的package包/類
/**
 * 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
    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);

}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:52,代碼來源:CameraManager.java

示例10: openDriver

import android.hardware.Camera; //導入方法依賴的package包/類
/**
 * 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, view.getWidth(), view.getHeight());
        if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
            setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight, requestedFramingRectTopOffset);
            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, mUseAutoFocus);
    } catch (RuntimeException re) {
        // Driver failed
        LogEx.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
        LogEx.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, mUseAutoFocus);
            } catch (RuntimeException re2) {
                // Well, darn. Give up
                LogEx.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
            }
        }
    }
    cameraObject.setPreviewDisplay(holder);

}
 
開發者ID:CoderChoy,項目名稱:BarcodeReaderView,代碼行數:52,代碼來源:CameraManager.java

示例11: openDriver

import android.hardware.Camera; //導入方法依賴的package包/類
/**
 * 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 = OpenCameraInterface.open(requestedCameraId);
        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");
            }
        }
    }

}
 
開發者ID:crisfg86,項目名稱:Zxing-Custom,代碼行數:52,代碼來源:CameraManager.java

示例12: openDriver

import android.hardware.Camera; //導入方法依賴的package包/類
/**
 * 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);
	}

	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");
			}
		}
	}

}
 
開發者ID:AnyRTC,項目名稱:anyRTC-RTCP-Android,代碼行數:57,代碼來源:CameraManager.java

示例13: openDriver

import android.hardware.Camera; //導入方法依賴的package包/類
/**
 * 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 = chooseOpen();
		if (theCamera == null) {
			throw new IOException();
		}
		camera = theCamera;
	}

	// 設置攝像頭預覽view
	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");
			}
		}
	}

}
 
開發者ID:dufangyu1990,項目名稱:LeCatApp,代碼行數:65,代碼來源:CameraManager.java

示例14: openDriver

import android.hardware.Camera; //導入方法依賴的package包/類
/**
 * 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 = OpenCameraInterface.open(requestedCameraId);
        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");
            }
        }
    }

}
 
開發者ID:snice,項目名稱:androidscan,代碼行數:47,代碼來源:CameraManager.java

示例15: openDriver

import android.hardware.Camera; //導入方法依賴的package包/類
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames
 *               into.
 * @throws java.io.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");
            }
        }
    }

}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:60,代碼來源:CameraManager.java


注:本文中的android.hardware.Camera.setPreviewDisplay方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。