Android Question cameraex v 1.3 commit parameters error

hayderOICO

Member
Licensed User
Longtime User
Dear all

upgraded to the latest v 1.3 of the cameraex class. and now getting an error every time commit parameter is called by the programme.


the "demo" camera app you bundled does work fine though. here's some of my code.

using b4A v 5.02

B4X:
#Region  Project Attributes
    #ApplicationLabel: Cam
    #VersionCode: 5
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: True
    #IncludeTitle: False
#End Region

Sub Process_Globals
    Private frontCamera As Boolean = False
    Private usbserial As felUsbSerial
    Private manager As UsbManager
    Dim DisableCameraTimer As Timer
    Dim TakePicTimer As Timer
End Sub

Sub Globals
    Private Panel1 As Panel
    Private Panel2 As Panel
    Private camEx As CameraExClass
    Private btnTakePicture As Button
    Dim awake As PhoneWakeState
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("allinone")

       If FirstTime Then
    manager.Initialize
      End If

    DisableCameraTimer.Initialize("DisableCameraTimer1",300)
    TakePicTimer.Initialize("pictimer",300)
    awake.KeepAlive(True)
End Sub


Sub Activity_Resume
    InitializeCamera
    manager.Initialize
    awake.KeepAlive(True)
End Sub

Private Sub InitializeCamera
    camEx.Initialize(Panel2, frontCamera, Me, "Camera1")
    DisableCameraTimer.Enabled=True
    frontCamera = camEx.Front
End Sub

Sub Activity_Pause (UserClosed As Boolean)
    camEx.Release
    awake.ReleaseKeepAlive
End Sub

Sub Camera1_Ready (Success As Boolean)
    If Success Then
        camEx.SetColorEffect("none")
        camEx.SetFlashMode("Off")
        camEx.SetPictureSize(4032, 3024)
        camEx.ExposureCompensation=-6
        camEx.CommitParameters
        camEx.StartPreview
    Else
        ToastMessageShow("Cannot open camera.", True)
    End If
End Sub

Sub btnTakePicture_Click
    If mode_select = "I" Then
        camEx.TakePicture
    Else
        camEx.SetFlashMode("torch")
        camEx.CommitParameters
        camEx.TakePicture
    End If
    btnTakePicture.Enabled = False
End Sub

Sub DisableCameraTimer1_Tick
    DisableCameraTimer.Enabled=False
    ProgressDialogHide
End Sub

Sub pictimer_Tick
    TakePicTimer.Enabled=False
    PicTake
End Sub

Sub PicTake
    camEx.TakePicture
    btnTakePicture.Enabled = False
End Sub

Sub Camera1_PictureTaken (Data() As Byte)
    camEx.SetFlashMode("off")
    camEx.CommitParameters
        Else 
    End If
End Sub
 

hayderOICO

Member
Licensed User
Longtime User
an error occured in
sub: cameraexclass_commitparameters (javal line: 145)
java.lang.RuntimeException:
setParameters failed
 
Last edited:
Upvote 0

hayderOICO

Member
Licensed User
Longtime User
hi

here's the complete log dump. obviously some of the errors are because of disconnected external microcontroller.

** Activity (main) Create, isFirst = true **
main_arduino_start (java line: 400)
java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
at oico.camera3.main._arduino_start(main.java:400)
at oico.camera3.main._activity_create(main.java:358)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at oico.camera3.main.afterFirstLayout(main.java:100)
at oico.camera3.main.access$100(main.java:17)
at oico.camera3.main$WaitForLayout.run(main.java:78)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5469)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
** Activity (main) Resume **
findCamera
null
2
facing: 0, 0
main_initializecamera (java line: 682)
java.lang.IllegalStateException: Interval must be larger than 0.
at anywheresoftware.b4a.objects.Timer.setEnabled(Timer.java:79)
at oico.camera3.main._initializecamera(main.java:682)
at oico.camera3.main._activity_resume(main.java:385)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at oico.camera3.main.afterFirstLayout(main.java:106)
at oico.camera3.main.access$100(main.java:17)
at oico.camera3.main$WaitForLayout.run(main.java:78)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5469)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
java.lang.IllegalStateException: Interval must be larger than 0.
findCamera
0
2
facing: 0, 0
90
(ArrayList) [none, mono, negative, solarize, sepia, posterize, whiteboard, blackboard, aqua, emboss, sketch, neon]
(ArrayList) [off, auto, on, torch]
[Loico.camera3.cameraexclass$_camerasize;@31ffb14
-12
cameraexclass_commitparameters (java line: 145)
java.lang.RuntimeException: setParameters failed
at android.hardware.Camera.native_setParameters(Native Method)
at android.hardware.Camera.setParameters(Camera.java:2012)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.agraham.reflection.Reflection.runmethod(Reflection.java:216)
at anywheresoftware.b4a.agraham.reflection.Reflection.RunMethod4(Reflection.java:857)
at oico.camera3.cameraexclass._commitparameters(cameraexclass.java:145)
at oico.camera3.main._camera1_ready(main.java:583)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:882)
at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:839)
at oico.camera3.cameraexclass._camera_ready(cameraexclass.java:102)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.objects.CameraW$2$1.run(CameraW.java:139)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at anywheresoftware.b4a.Msgbox.waitForMessage(Msgbox.java:198)
at anywheresoftware.b4a.Msgbox.msgbox(Msgbox.java:137)
at anywheresoftware.b4a.BA.ShowErrorMsgbox(BA.java:234)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:214)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at oico.camera3.main.afterFirstLayout(main.java:106)
at oico.camera3.main.access$100(main.java:17)
at oico.camera3.main$WaitForLayout.run(main.java:78)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5469)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
java.lang.RuntimeException: setParameters failed
 
Upvote 0

hayderOICO

Member
Licensed User
Longtime User
but I solved the issue. it was the set image size that was the problem.

but that worked fine in the past... so any way to get / set image size?

thanks for the help erel.
 
Upvote 0
Top