java - 在android中使用camera2拍照

标签 java android android-camera2

在“旧”相机 API 时代,我使用了简单的代码:

        Intent imageIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
        imageIntent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage);
        startActivityForResult(imageIntent, CAPTURE_IMAGE);

效果很好。

现在使用camera2,示例代码大约有1035行代码 - android-camera2Basic example .

是否有更简单的方法来使用新的camera2-API 拍照?

最佳答案

In the days of the "old" camera-API I used the simple code:

该代码与“旧的相机 API”(android.hardware.Camera) 无关。

Isn't there a simpler way of just taking a picture with the new camera2-API ?

你问题中的代码工作得很好......在 the limits of the camera apps that you might be linking to 内.

实现 android.hardware.Cameraandroid.hardware.camera2.* 容易一些,但也不是很多,而且这两个 API 都非常复杂。

关于java - 在android中使用camera2拍照,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42910729/

相关文章:

java - Apache Olingo4 ExpressionVisitor

java - android中的抽屉导航不是全屏

java - ViewPager - 添加或更新卡片时出现问题

android - 未触发 ActivityNotFoundException 打开下载的 PDF 文件

Android 在所有版本的 Android 上打开手电筒?

android - 在图像阅读器中将帧从 YUV_420_888 格式错误转换为 NV21

java - Android PiP 模式和应用程序生命周期

java - 基于 child 的Android ViewAnimator高度变化

android - 注意 : Failed to read get kotlin metadata for . ..etc 和类型转换器

java - Android camera2 镜头本征校准