Android Question Can't get the CameraEx class zoom function to work

Uitenhage

Member
Licensed User
Longtime User
Hi,

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

Any clues/help would be much appreciated.

Thanks,

Jim
 

arnold steger

Member
Licensed User
Longtime User
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
 
Last edited:
Upvote 0

Declan

Well-Known Member
Licensed User
Longtime User
I am using the code in post #1 and post #2.
I have added a SeekBar in the Designer.
However, the SeekBar does not show on the device screen?
 
Upvote 0
Top