如果捕获的图像> = 3264x2448,为什么会发生异常

时间:2014-03-12 08:49:17

标签: android android-camera

如果捕获的图像等于或大于(3264x2448),为什么会发生异常?图像< 3264x2448还可以。

public void surfaceCreated(SurfaceHolder holder) {
        // The Surface has been created, now tell the camera where to draw the
        // preview.
        try {
            mCamera.setPreviewDisplay(holder);
            mCamera.startPreview();
        } catch (IOException e) {
            Log.d("DEBUG", "Error setting camera preview: " + e.getMessage());
        }

    }

功能错误:

public void surfaceDestroyed(SurfaceHolder holder) {
        try {
            // Non camera related code

            // Start of camera related code
            // Only clean up what you need to
            if (mCamera != null) {

                mCamera.cancelAutoFocus();

                mCamera.stopPreview();
            }

        } catch (RuntimeException e) {

            e.printStackTrace();
        } finally {
            // Make sure that at least these two calls are made
            mCamera.release();
            mCamera = null;
        }
    }

例外:

 03-12 15:16:50.490: W/System.err(14817): java.lang.RuntimeException: Method called after release()
    03-12 15:16:50.492: W/System.err(14817):    at android.hardware.Camera.native_cancelAutoFocus(Native Method)
    03-12 15:16:50.494: W/System.err(14817):    at android.hardware.Camera.cancelAutoFocus(Camera.java:1024)
    03-12 15:16:50.496: W/System.err(14817):    at jp.osaka.CameraPreview.surfaceDestroyed(CameraPreview.java:47)
    03-12 15:16:50.498: W/System.err(14817):    at android.view.SurfaceView.updateWindow(SurfaceView.java:522)
    03-12 15:16:50.509: W/System.err(14817):    at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:226)
    03-12 15:16:50.511: W/System.err(14817):    at android.view.View.dispatchWindowVisibilityChanged(View.java:5851)
    03-12 15:16:50.513: W/System.err(14817):    at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:951)
    03-12 15:16:50.516: W/System.err(14817):    at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:951)
    03-12 15:16:50.518: W/System.err(14817):    at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:951)
    03-12 15:16:50.520: W/System.err(14817):    at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:951)
    03-12 15:16:50.522: W/System.err(14817):    at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:951)
    03-12 15:16:50.524: W/System.err(14817):    at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:951)
    03-12 15:16:50.526: W/System.err(14817):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1038)
    03-12 15:16:50.536: W/System.err(14817):    at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2583)
    03-12 15:16:50.539: W/System.err(14817):    at android.os.Handler.dispatchMessage(Handler.java:99)
    03-12 15:16:50.541: W/System.err(14817):    at android.os.Looper.loop(Looper.java:137)
    03-12 15:16:50.543: W/System.err(14817):    at android.app.ActivityThread.main(ActivityThread.java:4503)
    03-12 15:16:50.545: W/System.err(14817):    at java.lang.reflect.Method.invokeNative(Native Method)
    03-12 15:16:50.548: W/System.err(14817):    at java.lang.reflect.Method.invoke(Method.java:511)
    03-12 15:16:50.550: W/System.err(14817):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
    03-12 15:16:50.552: W/System.err(14817):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
    03-12 15:16:50.554: W/System.err(14817):    at dalvik.system.NativeStart.main(Native Method)

功能捕获图像:

                                      mCamera.lock();
                            // System.gc();
                            mCamera.takePicture(null, null, mPicture);
                            try {
                                Thread.sleep(500);
                            } catch (InterruptedException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                            }

0 个答案:

没有答案