Android Question B4XDRAWER and gameview gv_touch event problem

Marc De Loose

Licensed User
Longtime User
The drawer works if I dont have a gameview touch event sub. Once I put it in the code the drawer stops working.

Any workaround?
(I need the gv_touch or equivalent to do stuff)

This is my Activity create ( I addapted the AppCOmpat menuDrawer example to find out what the problem was).

the testcode (appcompat modification for testing)
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region
Sub Process_Globals

End Sub

Sub Globals
    Dim gv As GameView
    Private MenuDrawer As B4XDrawer
    Private ListView1 As ListView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    MenuDrawer.Initialize(Me, "Drawer", Activity, 300dip)
    Activity.AddView(gv, 0, 0, 100%x, 100%y)
    For i = 1 To 30
        ListView1.AddSingleLine("Item " & i)
End Sub

'Sub ACToolBarLight1_NavigationItemClick
'    Drawer.LeftOpen = Not(Drawer.LeftOpen)
'End Sub

Sub Activity_KeyPress (KeyCode As Int) As Boolean
    If KeyCode = KeyCodes.KEYCODE_BACK And MenuDrawer.LeftOpen Then
        MenuDrawer.LeftOpen = False
        Return True
    End If
    Return False
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

'If I comment out the gv_touch sub the drawer works
Sub gv_Touch (Action As Int, X As Float, Y As Float)
End Sub

Sub ListView1_ItemClick (Position As Int, Value As Object)
    Log("Position : " & Position & " - Value " & Value)
End Sub