本文整理汇总了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;
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}