Android - Fail to connect to camera

前端 未结 9 1012
日久生厌
日久生厌 2020-12-30 20:29

I\'m using the Android APIDemo sample code.

When I run the CameraPreview example, at first it was giving me an error.

I traced that one down and the sample

9条回答
  •  清歌不尽
    2020-12-30 20:48

    I also get this type of issue on a HTC device. To solve add this code:

    @Override
    protected void onDestroy() {
        // TODO Auto-generated method stub
        super.onDestroy();
        if (camera!=null)
        {
            camera.stopPreview();
            camera.release();
            camera=null;
        }
    }
    

    And yet you cannot start camera then restart device.

提交回复
热议问题