android - 如何保存相机实例?

标签 android android-camera

如何保存相机的状态,这样当我关闭屏幕并再次打开它时,相机会恢复到之前的状态。我应该 bundle 它吗?

public void getCamera() {
        if (camera == null) {
            try {
                camera = Camera.open();
                params = camera.getParameters();

            } catch (RuntimeException e) {
                Log.e(e.getMessage(), "Camera Error. Failed to Open. Error:Application will close! ");
                finish();
            }
        }
    }

最佳答案

通常你不想这样做 - 你想在 onPause 中释放相机并在 onResume 中重新捕获它,以便其他应用也可以使用它。

关于android - 如何保存相机实例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36224772/

相关文章:

android - 在 onPictureTaken 中处理原始图像数据

Android:Camera Crop intent Lollipop 及以上给出 toast 消息,因为此图像不支持编辑

android - 第二次从相机捕获时无法加载图像

Android Camera2 预览输出大小

android - 如何获取Wifi接入点的连接强度?

android - 运行 Android 应用程序时出错 - 无法初始化 OpenglES 仿真,请使用 '-gpu off' 禁用它

android - .isDisplayed - Selenium + Appium

java - 拍照失败 java.lang.runtimeexception 无法以 Intent 启动服务

安卓应用架构

android - 如何将 Base64 字符串转换为位图图像以在 ImageView 中显示?