Android Question cameraexclass error

dagodom

Member
Licensed User
Longtime User
Hello
I'm using BarcodeCamera and I get this error in a tablet with android 4.4.2.
the same app has no problems with android 8 (other versions I could not try)
if I remember correctly cameraexclass worked from version 2.2 of android.
com.google.android.gms: play-services-vision has a minimum version ?
Thanks

B4X:
** Activity (main) Resume **
Is detector operational: true
findCamera
null
2
facing: 0, 0
findCamera
3
2
facing: 0, 0
90
cameraexclass_commitparameters (java line: 215)
java.lang.RuntimeException: setParameters failed
    at android.hardware.Camera.native_setParameters(Native Method)
    at android.hardware.Camera.setParameters(Camera.java:1753)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.agraham.reflection.Reflection.runmethod(Reflection.java:216)
    at anywheresoftware.b4a.agraham.reflection.Reflection.RunMethod4(Reflection.java:857)
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
What parameters are you trying to set? It could be that the camera on the device doesn't support whatever it is you are trying to do.

- Colin.
 
Upvote 0

dagodom

Member
Licensed User
Longtime User
in the main module i have this call

B4X:
Sub Camera1_Ready (Success As Boolean)
    If Success Then
        camEx.SetJpegQuality(90)
        camEx.SetFocusMode("continuous-picture")
        camEx.CommitParameters
        camEx.StartPreview
        Log(camEx.GetPreviewSize)
    Else
        ToastMessageShow("Cannot open camera.", True)
    End

in CameraExClass :

B4X:
Public Sub CommitParameters
    'Try
    r.target = nativeCam
    r.RunMethod4("setParameters", Array As Object(parameters), Array As String("android.hardware.Camera$Parameters"))
    'Catch
    '        ToastMessageShow("Error setting parameters.", True)
    '        Log(LastException)
    '    End Try
End Sub
I try to change these two parameters, at this point I assume that the tablet does not support one of the two ...
Thanks
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
I suspect that it doesn't support continuous picture mode. I think I had the same issue with a Galaxy S3 running 4.4.2.

- Colin.
 
Last edited:
Upvote 0

dagodom

Member
Licensed User
Longtime User
I confirm, without working even if it does not focus.
I try to change the "continuous-picture" parameter.
Now I'm looking in the documentation
Thanks again.
 
Upvote 0
Top