当前位置: 首页>>代码示例>>Java>>正文


Java Camera.stopPreview方法代码示例

本文整理汇总了Java中android.hardware.Camera.stopPreview方法的典型用法代码示例。如果您正苦于以下问题:Java Camera.stopPreview方法的具体用法?Java Camera.stopPreview怎么用?Java Camera.stopPreview使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.hardware.Camera的用法示例。


在下文中一共展示了Camera.stopPreview方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: stopPreviewInternal

import android.hardware.Camera; //导入方法依赖的package包/类
private void stopPreviewInternal(boolean internal) {
    try {
        DecoderWrapper decoderWrapper = mDecoderWrapper;
        Camera camera = decoderWrapper.getCamera();
        if (!internal && decoderWrapper.isFlashSupported() && mFlashEnabled) {
            Camera.Parameters parameters = camera.getParameters();
            if (parameters != null && Utils.setFlashMode(parameters, Camera.Parameters.FLASH_MODE_OFF)) {
                camera.setParameters(parameters);
            }
        }
        camera.setPreviewCallback(null);
        camera.stopPreview();
    } catch (Exception ignored) {
    }
    mStoppingPreview = false;
    mPreviewActive = false;
    mSafeAutoFocusing = false;
    mSafeAutoFocusAttemptsCount = 0;
}
 
开发者ID:yuriy-budiyev,项目名称:code-scanner,代码行数:20,代码来源:CodeScanner.java

示例2: onPictureTaken

import android.hardware.Camera; //导入方法依赖的package包/类
public void onPictureTaken(byte[] data, Camera camera) {
    Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
    photos.add(imagecompress.comp(bitmap));
    bitmap.recycle();
    camera.stopPreview();
    camera.startPreview();
}
 
开发者ID:kagurazakayashi,项目名称:achoosephoto,代码行数:8,代码来源:MainActivity.java

示例3: stopPreview

import android.hardware.Camera; //导入方法依赖的package包/类
@ReactMethod
public void stopPreview(ReadableMap options) {
    RCTCamera instance = RCTCamera.getInstance();
    if (instance == null) return;

    Camera camera = instance.acquireCameraInstance(options.getInt("type"));
    if (camera == null) return;

    camera.stopPreview();
}
 
开发者ID:entria,项目名称:react-native-camera-face-detector,代码行数:11,代码来源:RCTCameraModule.java

示例4: getCameraPreviewSize

import android.hardware.Camera; //导入方法依赖的package包/类
public static ArrayList<HashMap<String, Integer>> getCameraPreviewSize(
		int cameraId) {
	ArrayList<HashMap<String, Integer>> size = new ArrayList<HashMap<String, Integer>>();
	Camera camera = null;
	try {
		camera = Camera.open(cameraId);
		if (camera == null)
			camera = Camera.open(0);

		List<Camera.Size> allSupportedSize = camera.getParameters()
				.getSupportedPreviewSizes();
		for (Camera.Size tmpSize : allSupportedSize) {
			if (tmpSize.width > tmpSize.height) {
				HashMap<String, Integer> map = new HashMap<String, Integer>();
                   map.put("width", tmpSize.width);
                   map.put("height", tmpSize.height);
                   if (tmpSize.width==640&&tmpSize.height==480){
                       size.add(map);
                   }
                   if (tmpSize.width==960&&tmpSize.height==540){
                       size.add(map);
                   }
                   if (tmpSize.width==1280&&tmpSize.height==720){
                       size.add(map);
                   }
                   if (tmpSize.width==1920&&tmpSize.height==1080){
                       size.add(map);
                   }

			}
		}

	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		if (camera != null) {
			camera.stopPreview();
			camera.setPreviewCallback(null);
			camera.release();
			camera = null;
		}
	}

	return size;
}
 
开发者ID:FacePlusPlus,项目名称:MegviiFacepp-Android-SDK,代码行数:46,代码来源:ICamera.java

示例5: flashOff

import android.hardware.Camera; //导入方法依赖的package包/类
private void flashOff(Camera cam) {
    Camera.Parameters p = cam.getParameters();
    p.setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
    cam.setParameters(p);
    cam.stopPreview();
}
 
开发者ID:ivybao0628,项目名称:MorseKnown,代码行数:7,代码来源:FlashExecutor.java


注:本文中的android.hardware.Camera.stopPreview方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。