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

This code example shows how to use the following methods:cancelAutoFocus
  public void autoFocus() { 
    camera.autoFocus(getHost());
  } 
 
  public void cancelAutoFocus() { 
    camera.cancelAutoFocus();
  } 
 
  // based on CameraPreview.java from ApiDemos 
 
  @Override 
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    final int width=
        resolveSize(getSuggestedMinimumWidth(), widthMeasureSpec);
    final int height=
        resolveSize(getSuggestedMinimumHeight(), heightMeasureSpec);
    setMeasuredDimension(width, height);
 
    if (previewSize == null && camera != null) {
      previewSize=
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:cancelAutoFocus, release, setPreviewCallback, stopPreview
 
        // Because the Camera object is a shared resource, it's very 
        // important to release it when the activity is paused. 
        if (mCamera != null) {
            mPreview.setCamera(null);
            mCamera.cancelAutoFocus();
            mCamera.setPreviewCallback(null);
            mCamera.stopPreview();
            mCamera.release();
            mCamera = null;
        } 
    } 
 
    public void onPreviewFrame(byte[] data, Camera camera) {
        Camera.Parameters parameters = camera.getParameters();
        Camera.Size size = parameters.getPreviewSize();
 
        Result rawResult = null;
        PlanarYUVLuminanceSource source = new PlanarYUVLuminanceSource(data, size.width, size.height, mPreview.getLeft(), mPreview.getTop(),
                                        size.width, size.height, false);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:cancelAutoFocus, release, setPreviewCallback, setPreviewDisplay, stopPreview
 
	public void stopPreview() { 
		Log.v(TAG, "Camera - stopPreview");
 
		if (mPreviewing == true) {
			mCamera.stopPreview();
		} 
 
		mPreviewing = false;
	} 
 
	public void setPreviewDisplay(SurfaceHolder holder) {
		Log.v(TAG, "Camera - setPreviewDisplay");
 
		try { 
			mCamera.setPreviewDisplay(holder);
		} catch (Throwable e) {
			closeCamera(); 
			throw new RuntimeException("Camera - setPreviewDisplay failed", e);
		} 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:cancelAutoFocus
  } 
 
  synchronized void stop() { 
    if (useAutoFocus) {
      try { 
        camera.cancelAutoFocus();
      } catch (RuntimeException re) {
        // Have heard RuntimeException reported in Android 4.0.x+; continue? 
        Log.w(TAG, "Unexpected exception while cancelling focusing", re);
      } 
    } 
    if (outstandingTask != null) {
      outstandingTask.cancel(true);
      outstandingTask = null;
    } 
    active = false;
  } 
 
  private final class AutoFocusTask extends AsyncTask<Object,Object,Object> {
    @Override 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:cancelAutoFocus, release, setPreviewCallback, stopPreview
   */ 
  public void stop() { 
    if (focus_manager != null)
      focus_manager.stop();
    if (cam != null) {
      cam.stopPreview();
      cam.setPreviewCallback(null);
      cam.cancelAutoFocus();
      cam.release();
      cam = null;
    } 
    ready = false;
    frame_requested = false;
  } 
 
  /** 
   * Asks for a new frame to be delivered to the listener. 
   */ 
  public void requestNewFrame() { 
    if (!ready)
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:cancelAutoFocus
  	timer.schedule(outstandingTask, delay); 
  } 
 
  synchronized void stop() { 
    if (useAutoFocus) { 
      camera.cancelAutoFocus(); 
    } 
    if (outstandingTask != null) { 
      outstandingTask.cancel(); 
      outstandingTask = null; 
    } 
    active = false; 
    manual = false; 
  } 
 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:cancelAutoFocus
	} 
 
	synchronized void stop() { 
		if (useAutoFocus) {
			try { 
				camera.cancelAutoFocus();
			} catch (RuntimeException re) {
				// Have heard RuntimeException reported in Android 4.0.x+; 
				// continue? 
				Log.w(TAG, "Unexpected exception while cancelling focusing", re);
			} 
		} 
		if (outstandingTask != null) {
			outstandingTask.cancel(true);
			outstandingTask = null;
		} 
		active = false;
	} 
 
	private final class AutoFocusTask extends AsyncTask<Object, Object, Object> {
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:cancelAutoFocus
  	timer.schedule(outstandingTask, delay);
  } 
 
  synchronized void stop() { 
    if (useAutoFocus) {
      camera.cancelAutoFocus();
    } 
    if (outstandingTask != null) {
      outstandingTask.cancel();
      outstandingTask = null;
    } 
    active = false;
    manual = false;
  } 
 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:cancelAutoFocus
	} 
 
	synchronized void stop() { 
		if (useAutoFocus) {
			try { 
				camera.cancelAutoFocus();
			} catch (RuntimeException re) {
				// Have heard RuntimeException reported in Android 4.0.x+; 
				// continue? 
				Log.w(TAG, "Unexpected exception while cancelling focusing", re);
			} 
		} 
		if (outstandingTask != null) {
			outstandingTask.cancel(true);
			outstandingTask = null;
		} 
		active = false;
	} 
 
	private final class AutoFocusTask extends AsyncTask<Object, Object, Object> {
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:autoFocus, cancelAutoFocus
		if (ev.getAction() == MotionEvent.ACTION_DOWN) {
			if (mHasSurface && mCamera != null && mCanAutoFocus && mFocusState != FOCUSING) {
				mFocusState = FOCUSING;
				// Log.e("SunSurveyor", "autofocusing!"); 
				try { 
					mCamera.autoFocus(mAutoFocusCallback);
				} catch (RuntimeException re) {
					try { 
						mFocusState = FOCUS_NOT_STARTED;
						mCamera.cancelAutoFocus();
					} catch (RuntimeException re2) {
 
					} 
				} 
			} 
		} else if (ev.getAction() == MotionEvent.ACTION_UP) {
			if (mHasSurface && mCamera != null && mCanAutoFocus && mFocusState == FOCUSING) {
				mCamera.cancelAutoFocus();
				mFocusState = FOCUS_NOT_STARTED;
			} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Camera cancelAutoFocus Questions & Answers:

cancelAutoFocus Method Overview
Cancels any auto-focus function in progress.
See Code Examples for other Android Camera Methods: