Android Question B4XDRAWER and gameview gv_touch event problem

Marc De Loose

Member
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)
B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region
    #Extends: android.support.v7.app.AppCompatActivity
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)
   
    gv.Initialize("gv")
    MenuDrawer.Initialize(Me, "Drawer", Activity, 300dip)
    MenuDrawer.LeftPanel.LoadLayout("Left")
    Activity.AddView(gv, 0, 0, 100%x, 100%y)
    'ListView1.Color=Colors.Black
    ListView1.SingleLineLayout.Label.TextSize=25
    ListView1.SingleLineLayout.ItemHeight=40
    For i = 1 To 30
        ListView1.AddSingleLine("Item " & i)
       
    Next
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
 
Top