Android Question Reflection and scrollview

I'm using reflection library to find out if scrollview is scrolled up or down.
my first problem is that if I use reflect.Target = scroll it is impossible for scrollview to be scrolled and if I use reflect.Target = scroll.panel it is impossible to find out whether is scrolled up or down
so
1- Is there any other way? my code is this
B4X:
Dim StartY As Int

reflect.Target = scroll         ' or  reflect.Target = scroll.panel  ??!!
reflect.SetOnTouchListener("Pnl_Touch")

Sub Pnl_Touch(lblTest1 As Object, Action As Int, X As Float, Y As Float, MotionEvent As Object) As Boolean

    Select Action
        Case scroll.Panel.ACTION_DOWN
            StartY = Y
  
        Case scroll.Panel.ACTION_UP
            If Abs(Y - StartY) > MOVEMENT_THRESHOLD Then       ' MOVEMENT_THRESHOLD  is a number like 20dip
                Swipe(Y > StartY)
            End If
    End Select
  
    Return True

End Sub

Sub Swipe(Down As Boolean)
    If Down Then
           Log("DOWN")
    Else
           Log("Up")
    End If
End Sub

As I said if you use using reflect.Target = scroll It is impossible for scrollview to be scrolled (If you use ScrollChanged(Position As Int) and log(Position) it will show you always 0) so I use scroll.ScrollToNow(StartY-Y) inside Pnl_Touch function and it solves my problem into some extends but it doesn't scroll as good as a scrollview. Therefore my second question is:
2- What exactly shall I put in scroll.ScrollToNow() as argument to behave as a scrollview?
 
Last edited:
Top