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

后端 未结 3 1872
慢半拍i
慢半拍i 2021-01-13 16:55

I have developed an application which captures a photo when punch in at the time. It\'s working good on Acer tab(capturing image and saves in sdcard). Now when I run the sam

相关标签:
3条回答
  • 2021-01-13 17:05

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

    0 讨论(0)
  • 2021-01-13 17:26
    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();
            }
        }
    }
    
    0 讨论(0)
  • 2021-01-13 17:28

    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.

    0 讨论(0)
提交回复
热议问题