1

When my picture is taken via takePicture() function, Cwac-camera crash (depending device, work well on Desire HD, crash on Nexus S).

Referring to this post : camera.setParameters failed in android

I would like to know how to do this with Cwac-camera.

Backtrace:

07-03 20:58:57.207  24659-24659/com.xxxxxx                    E/AndroidRuntime: FATAL EXCEPTION: main
    java.lang.RuntimeException: setParameters failed
    at android.hardware.Camera.native_setParameters(Native Method)
    at android.hardware.Camera.setParameters(Camera.java:1410)
    at com.commonsware.cwac.camera.CameraView$OnOrientationChange.onOrientationChanged(CameraView.java:413)
    at android.view.OrientationEventListener$SensorEventListenerImpl.onSensorChanged(OrientationEventListener.java:143)
    at android.hardware.SystemSensorManager$ListenerDelegate$1.handleMessage(SystemSensorManager.java:204)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4745)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
    at dalvik.system.NativeStart.main(Native Method)
Community
  • 1
  • 1
Quentin Rousseau
  • 330
  • 5
  • 13

1 Answers1

0

This crash is not coming from takePicture(). If you look at the stack trace, you will not see takePicture(). Instead, this is coming from an orientation change. Specifically, you appear to have the device locked to an orientation, causing CameraView to use sensors to detect the device orientation to try to adjust the camera settings, and we're dying there.

If you can reproduce this problem with the demo app, please file an issue with the steps to reproduce it, as I cannot reproduce it on a Nexus S with the demo app.

If you cannot reproduce this problem with the demo app, and you can publish a reproducible test case, please file an issue with the source code to the reproducible test case.

Otherwise, you will have to hope that the problem that you are experiencing is related to this issue on switching cameras with the Nexus S, and then further hope that I can figure out what that problem is.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • I'm working with v.0.0.2 and set android:screenOrientation="portrait" locked to my AndroidManifest.xml. Have you tried with this. Regards, – Quentin Rousseau Jul 03 '13 at 19:30
  • @QuentinRousseau: I'll take a look at it sometime this weekend, if all goes well. – CommonsWare Jul 03 '13 at 19:33
  • Precision: Work well when android:screenOrientation="portrait" is not setted but crash when orientation changed. Regards, – Quentin Rousseau Jul 03 '13 at 20:01
  • @QuentinRousseau: OK, I can reproduce the problem and I have it at least minimized, possibly outright fixed. Monitor https://github.com/commonsguy/cwac-camera/issues/12 to learn when I publish the update containing the fix. – CommonsWare Jul 06 '13 at 15:19
  • @CommonsWare- how to hide the action bar??the preview is stopped if i use actionbar.hide(); in the MainActivity. – Rishabh Srivastava Feb 19 '14 at 08:49