Android Question Is there a way to capture the back key click event in a custom view?

demasi

Active Member
Licensed User
Longtime User
Hello all,

Is there a way to capture the back key click event in a custom view?

And if this is possible, is also possible to send the key back to the main activity for normal processing?

Thank you!
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Not directly. You will need to call the relevant sub from Activity_KeyPress (in the main module).

You can return a boolean variable and if it is true then return from Activity_KeyPress:
B4X:
Sub Activity_KeyPress (KeyCode As Int) 
   If MyCustomView.KeyPress(KeyCode) = True Then Return True
   Return False
End Sub
 
Upvote 0
Top