Camera setOneShotPreviewCallback - 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 setOneShotPreviewCallback method.

This code example shows how to use the following methods:setOneShotPreviewCallback
   */ 
  public synchronized void requestPreviewFrame(Handler handler, int message) {
    Camera theCamera = camera;
    if (theCamera != null && previewing) {
      previewCallback.setHandler(handler, message);
      theCamera.setOneShotPreviewCallback(previewCallback);
    } 
  } 
 
  /** 
   * Calculates the framing rect which the UI should draw to show the user where to place the 
   * barcode. This target helps with alignment as well as forces the user to hold the device 
   * far enough away to ensure the image will be in focus. 
   * 
   * @return The rectangle to draw on screen in window coordinates. 
   */ 
  public synchronized Rect getFramingRect() {
    if (framingRect == null) {
      if (camera == null) {
        return null; 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setOneShotPreviewCallback
   */ 
  public synchronized void requestPreviewFrame(Handler handler, int message) {
    Camera theCamera = camera;
    if (theCamera != null && previewing) {
      previewCallback.setHandler(handler, message);
      theCamera.setOneShotPreviewCallback(previewCallback);
    } 
  } 
 
  /** 
   * Calculates the framing rect which the UI should draw to show the user where to place the 
   * barcode. This target helps with alignment as well as forces the user to hold the device 
   * far enough away to ensure the image will be in focus. 
   * 
   * @return The rectangle to draw on screen in window coordinates. 
   */ 
  public synchronized Rect getFramingRect() {
    if (framingRect == null) {
      if (camera == null) {
        return null; 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setOneShotPreviewCallback
  public void testSetOneShotPreviewCallbacks() throws Exception { 
    TestPreviewCallback callback = new TestPreviewCallback();
    assertThat(callback.camera).isNull();
    assertThat(callback.data).isNull();
 
    camera.setOneShotPreviewCallback(callback);
    shadowCamera.invokePreviewCallback("foobar".getBytes());
 
    assertThat(callback.camera).isSameAs(camera);
    assertThat(callback.data).isEqualTo("foobar".getBytes());
  } 
 
  @Test 
  public void testPreviewCallbacksWithBuffers() throws Exception { 
    TestPreviewCallback callback = new TestPreviewCallback();
    assertThat(callback.camera).isNull();
    assertThat(callback.data).isNull();
 
    camera.setPreviewCallbackWithBuffer(callback);
    shadowCamera.invokePreviewCallback("foobar".getBytes());
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setOneShotPreviewCallback
   */ 
  public synchronized void requestOcrDecode(Handler handler, int message) {
    Camera theCamera = camera;
    if (theCamera != null && previewing) {
      previewCallback.setHandler(handler, message);
      theCamera.setOneShotPreviewCallback(previewCallback);
    } 
  } 
   
  /** 
   * Asks the camera hardware to perform an autofocus. 
   * @param delay Time delay to send with the request 
   */ 
  public synchronized void requestAutoFocus(long delay) {
  	autoFocusManager.start(delay);
  } 
   
  /** 
   * Calculates the framing rect which the UI should draw to show the user where to place the 
   * barcode. This target helps with alignment as well as forces the user to hold the device 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:autoFocus, release, setErrorCallback, setOneShotPreviewCallback, setPreviewCallback
        // Because the Camera object is a shared resource, it's very 
        // important to release it when the activity is paused. 
        if (mCamera != null)
        { 
            // reset all the callbacks 
            mCamera.autoFocus(null);
            mCamera.setErrorCallback(null);
            mCamera.setOneShotPreviewCallback(null);
            mCamera.setPreviewCallback(null);
            mCamera.setPreviewCallbackWithBuffer(null);
            mCamera.setZoomChangeListener(null);
            mCamera.release();
            mCamera = null;
        } 
    } 
 
    /** 
     * Switching from one camera to another. Must stop the preview, free the 
     * previous camera, and open the new camera, in that order. 
     */ 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:autoFocus, release, setErrorCallback, setOneShotPreviewCallback, setPreviewCallback
        // Because the Camera object is a shared resource, it's very 
        // important to release it when the activity is paused. 
        if (mCamera != null)
        { 
            // reset all the callbacks 
            mCamera.autoFocus(null);
            mCamera.setErrorCallback(null);
            mCamera.setOneShotPreviewCallback(null);
            mCamera.setPreviewCallback(null);
            mCamera.setPreviewCallbackWithBuffer(null);
            mCamera.setZoomChangeListener(null);
            mCamera.release();
            mCamera = null;
        } 
    } 
 
    /** 
     * Switching from one camera to another. Must stop the preview, free the 
     * previous camera, and open the new camera, in that order. 
     */ 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setOneShotPreviewCallback, startPreview
    private final void startPreview() { 
		if(!mIsSurfaceCreated || (mCamera == null)) 
			return; 
 
		if(mCameraPreviewer != null) {
			mCameraPreviewer.init(mCamera);
			mCamera.setOneShotPreviewCallback(mCameraPreviewer);
		} 
		 
		mCamera.startPreview();
	} 
	 
	/** 
	 * Stops the preview from the camera, unregisters the callback and closes it. 
	 */ 
    private final void stopPreview() { 
		if(mCamera == null) 
			return; 
		 
		mCamera.stopPreview();
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setOneShotPreviewCallback
		camera.setParameters(parameters);
	} 
 
	public void requestPreviewFrame(final PreviewCallback callback)
	{ 
		camera.setOneShotPreviewCallback(callback);
	} 
 
	public PlanarYUVLuminanceSource buildLuminanceSource(final byte[] data)
	{ 
		return new PlanarYUVLuminanceSource(data, cameraResolution.width, cameraResolution.height, framePreview.left, framePreview.top,
				framePreview.width(), framePreview.height(), false);
	} 
 
	public void setTorch(final boolean enabled)
	{ 
		if (enabled != getTorchEnabled(camera))
			setTorchEnabled(camera, enabled);
	} 
 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setOneShotPreviewCallback
     */ 
    public void requestPreviewFrame(Handler handler, int message)
    { 
        if (_camera != null && _previewing) {
            previewCallback.setHandler(handler, message);
            _camera.setOneShotPreviewCallback(previewCallback);
        } 
    } 
 
    /** 
     * Asks the _camera hardware to perform an autofocus. 
     *  
     * @param handler 
     *            The Handler to notify when the autofocus completes. 
     * @param message 
     *            The message to deliver. 
     */ 
    public void requestAutoFocus(Handler handler, int message)
    { 
        if (_camera != null && _previewing) {
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setOneShotPreviewCallback
        _cameraPreviewStopped = true;
    } 
     
    public void freezeCamera() 
    { 
        _cameraObject.setOneShotPreviewCallback(this);
    } 
 
    @Override 
    public void onPreviewFrame(byte[] data, Camera camera)
    { 
         
    } 
 
    public void getFirstCamera() throws Exception 
    { 
        Log.d(Constants.LOG, "Finding first usable camera.");
         
        StringBuilder exceptions = new StringBuilder();
         
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
setOneShotPreviewCallback Method Overview
Installs a callback to be invoked for the next preview frame in addition to displaying it on the screen.
See Code Examples for other Android Camera Methods: