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

Discussion in 'Android Questions' started by Uitenhage, Dec 18, 2013.

  1. Uitenhage

    Uitenhage Member Licensed 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:

    Code:
    '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):

    Code:
    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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    This code should work:
    Code:
    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
     
  3. Uitenhage

    Uitenhage Member Licensed User

    Thank You! Once again You Rock!

    I was missing the "camEx.CommitParameters" line.
     
  4. arnold steger

    arnold steger Member Licensed User

    How can call setZoom whit SeekBar1_ValueChanged for your example ?
    have add in cameraexclass the code

    Code:
    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: Feb 20, 2015
  5. Erel

    Erel Administrator Staff Member Licensed User

    Have you seen the code in post #2?
     
  6. arnold steger

    arnold steger Member Licensed User

    Yes. Post #2 is for set max zoom?
    I want to set a adjustable value for zoom.
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    No. Post #2 sets the zoom based on the seekbar value.
     
  8. arnold steger

    arnold steger Member Licensed User

    Run correctly. In ClassModul code was my error. Thanks
     
  9. 吳界明

    吳界明 Member Licensed User

    I want to sets the zoom based on the seekbar value, but why can't work?
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    What is not working? Are you using the code from post #2?
     
  11. Declan

    Declan Active Member Licensed 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?
     
  12. Erel

    Erel Administrator Staff Member Licensed User

    This is an old thread. Please start a new thread for this (also better if you upload your project).
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice