Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
If ModalDialog.Visible Then
ModalDialog.Visible = False 'Hide modal only
Return False 'and dont go further
Else
Return True 'do like what normal back_button do
End If
End If
End Sub