java.Lang.RuntimeException, setParameters failed in android(4.1.1) version

心已入冬 提交于 2019-12-01 06:25:10

Call the startPreview method before you call takePicture method camera.takePicture(null, null, mCall); and the startPreview method I used is

private void startPreview() {
        if (cameraConfigured && camera!=null) {
          camera.startPreview();
          inPreview=true;
        }
      }

and through this I solved my issue... It may help you guys.

It is not working in all cases. You call getSupportedPictureSizes() then you can get the list. And choose parameters in setPictureSize() from the list.

private void flipBackToFrontCamera() {

    if (mCamera != null) {
        mCamera.stopPreview();
        mCamera.release();
        mCamera = null;
    }

    mCamera = Camera.open(1);

    if (mCamera != null) {
        try {
            mCamera.setPreviewDisplay(surfaceView.getHolder());
            mCamera.startPreview();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!