File tree Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,11 @@ Sub Activity_ActionBarHomeClick
51
51
End Sub
52
52
53
53
Sub Activity_KeyPress (KeyCode As Int) As Boolean
54
- Return B4XPages.Delegate.Activity_KeyPress(KeyCode)
54
+ If KeyCode = KeyCodes.KEYCODE_BACK Then
55
+ Return B4XPages.Delegate.Activity_KeyPress(KeyCode)
56
+ End If
57
+ B4XPages.GetManager.RaiseEvent(B4XPages.GetManager.GetTopPage, "B4XPage_KeyPress", Array(KeyCode))
58
+ Return False
55
59
End Sub
56
60
57
61
Sub Activity_Resume
Original file line number Diff line number Diff line change @@ -31,4 +31,27 @@ End Sub
31
31
32
32
Private Sub Button1_Click
33
33
xui.MsgboxAsync("Hello world!" , "B4X" )
34
- End Sub
34
+ End Sub
35
+
36
+ #If B4A
37
+ Private Sub B4XPage_KeyPress (KeyCode As Int ) As Boolean 'ignore
38
+ Select KeyCode
39
+ Case KeyCodes.KEYCODE_BACK
40
+ 'code to handle back key
41
+ Case KeyCodes.KEYCODE_VOLUME_DOWN, KeyCodes.KEYCODE_VOLUME_UP
42
+ 'code to handle volume keys
43
+ Case KeyCodes.KEYCODE_MEDIA_PLAY_PAUSE
44
+ 'code to handle media button
45
+ Case Else
46
+ Return False 'Pass to Android System
47
+ End Select
48
+ End Sub
49
+
50
+ Private Sub B4XPage_CloseRequest As ResumableSub
51
+ 'If Drawer.LeftOpen Then
52
+ ' Drawer.LeftOpen = False
53
+ ' Return False
54
+ 'End If
55
+ Return True
56
+ End Sub
57
+ #End If
You can’t perform that action at this time.
0 commit comments