Android Code Snippet Handle swipe left/right event

B4X:
Private minDistance As Int = 150
Private x1,x2 As Float
Sub pnlPhoto_Touch (Action As Int, X As Float, Y As Float)
    Select    Action
        Case 0
            x1 = x
        Case 1
            x2 = x
            Private deltaX = x2 - x1
            If Abs(deltaX) > minDistance Then
                If x2 > x1 Then
                    ToastMessageShow("Left to right",False)
                Else
                    ToastMessageShow("Right to left",False)
                End If
            End If
    End Select
End Sub
 
Top