Android Question CameraEX Zoom problem

Declan

Well-Known Member
Licensed User
Longtime User
Running the CameraEx example, I am trying to get the Zoom function working with a seekbar:
B4X:
Sub sbZoom_ValueChanged (Value As Int, UserChanged As Boolean)
   If UserChanged = False Or camEx.IsZoomSupported = False Then Return
   camEx.Zoom = Value / 100 * camEx.GetMaxZoom
   camEx.CommitParameters
   Log("Zoom Supported: " & camEx.IsZoomSupported)
   Log("Zoom Max :" & camEx.GetMaxZoom)
   Log("Zoom SB Value : " & Value)
   Log("Zoom Value : " & camEx.Zoom)
End Sub
However, the Zoom value is always 10 (MaxZoom)
Log:
B4X:
Zoom Supported: true
Zoom Max :10
Zoom SB Value : 50
Zoom Value : 10
SeekBar Max value = 100
 

strat

Active Member
Licensed User
Longtime User
It looks a simple syntax in the CameraexClass is caused this error.
Value always set the maxzoom in the class.
Cancelling the "Value=Max(Value,GetMaxZoom)" line should solve the problem.

B4X:
Public Sub setZoom(Value As Int)
    'Value=Max(Value,GetMaxZoom)
    If isZoomSupported Then
        r.target = parameters
        r.RunMethod2("setZoom", Value, "java.lang.int")
    Else
        Log("Zoom not supported.")
    End If
End Sub
 
Upvote 0
Top