In belows code i can press the back key as often as i want to and it works just fine. But when i press the menu key my app crashes. This crash can happen after the first, second or third click. I cannot understand this behaviour, because the executed code for both keys is the same.
I'd be happy if you could help me out
P.s.: The PanelWithSidebar stuff is from @Informatix and can be found here: https://www.b4x.com/android/forum/threads/class-slidingsidebar.21533/
I'd be happy if you could help me out
B4X:
Sub Activity_KeyPress(KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
If PanelWithSidebar.IsSidebarVisible = True Then
PanelWithSidebar.CloseSidebar
Else
PanelWithSidebar.OpenSidebar
End If
Else If KeyCode = KeyCodes.KEYCODE_MENU Then
If PanelWithSidebar.IsSidebarVisible = True Then
PanelWithSidebar.CloseSidebar
Else
PanelWithSidebar.OpenSidebar
End If
End If
Return True
End Sub
P.s.: The PanelWithSidebar stuff is from @Informatix and can be found here: https://www.b4x.com/android/forum/threads/class-slidingsidebar.21533/