Android Question CameraEx Error in sample code

Alwinl

Member
Licensed User
Longtime User
I downloaded the CameraEX library (1.20) to use with Camera lib 2.20 on Android 4.1.1. Using the sample code as-is I get the error below when taking a picture, it seems to be coming from 'cam.TakePicture' in the CameraEx library. The weird thing is that the photo seems to be ok after I dismiss the error.



An error has occurred in sub:cameraexclass_takepicture(B4A line: 100)
End Sub
java.lang.RuntimeException: takePicture failed
Continue?
 

Alwinl

Member
Licensed User
Longtime User
The log says:

cameraexclass_takepicture (B4A line: 100)
cam.TakePicture
java.lang.RuntimeException: takePicture failed
at android.hardware.Camera.native_takePicture(Native Method)
at android.hardware.Camera.takePicture(Camera.java:1061)
at android.hardware.Camera.takePicture(Camera.java:1006)
at anywheresoftware.b4a.objects.CameraW.TakePicture(CameraW.java:287)
at b4a.example.cameraexclass._takepicture(cameraexclass.java:1147)
at b4a.example.cameraexclass._camera_focusdone(cameraexclass.java:92)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
at anywheresoftware.b4a.objects.CameraW$3.onAutoFocus(CameraW.java:195)
at android.hardware.Camera$EventHandler.handleMessage(Camera.java:769)
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)
 
Upvote 0

Alwinl

Member
Licensed User
Longtime User
There is no more info in the unfiltered logs, I have tried fiddling the parameters but still I get the error.

What is strange is that the photo always gets taken ie. Camera_PictureTaken gets called and I see the photo. Once in a while I get no error but 99% of the time I do get the error.
If I put error handling around TakePicture I think my problem will be solved, but I prefer to keep the libraries standard so I don't need to worry about the bits I've edited when downloading new versions.
 
Upvote 0
Top