I cannot get the CameraEX class to zoom. It doesn't throw any exceptions in the zoom code below.
In the Activity I'm using Stevel05's InputSlider class:
B4X:
'Callback Sub from InputSlider class
Sub islZoom_PosChanged(Value As Double)
Dim p1 As Int = MaxZoom*Value
CamEx.Zoom = p1
CurrentZoom = CamEx.Zoom
End Sub
And in the CameraEx class I added these Subs from other threads (Erel's I think):
B4X:
Public Sub IsZoomSupported As Boolean
r.target = parameters
Return r.RunMethod("isZoomSupported")
End Sub
Public Sub GetMaxZoom As Int
r.target = parameters
Return r.RunMethod("getMaxZoom")
End Sub
Public Sub getZoom() As Int
r.target = parameters
Return r.RunMethod("getZoom")
End Sub
Public Sub setZoom(ZoomValue As Int)
r.target = parameters
r.RunMethod2("setZoom", ZoomValue, "java.lang.int")
End Sub
Sub SeekBar1_ValueChanged (Value As Int, UserChanged As Boolean)
If UserChanged = False OR camEx.IsZoomSupported = False Then Return
camEx.Zoom = Value / 100 * camEx.GetMaxZoom
camEx.CommitParameters
End Sub
How can call setZoom whit SeekBar1_ValueChanged for your example ?
have add in cameraexclass the code
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