Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
Select KeyCode
Case KeyCodes.KEYCODE_BACK
If mChiusuraConsentita Then
Return False
Else
Return True
End If
End Select
Return False
End Sub
Se non devi inserire altro codice di controllo, puoi scrivere direttamente:
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
Select KeyCode
Case KeyCodes.KEYCODE_BACK
Return not(mChiusuraConsentita)
End Select
Return False
End Sub
[Non l'ho scritto perché è ovvio, dato il nome... mChiusuraConsentita è una variabile booleana globale...]
Volendo, anche più breve :
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If KeyCode = KeyCodes.KEYCODE_BACK Then Return not(mChiusuraConsentita)
Return False
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.